Wednesday, March 7, 2012

How to improve Web application performance

 For application performance you need to some r & d on your query mean stored procedure  
 see their retrieval cost and find where it is taking too much time to retriev the data  
 and do some action on that table.  
 For eg.   
 1.You should be use index whereever required  
 2.Use joining if required otherwise remove unnesseary join.  
 3.Select only required field from table. can using caching  
 5.Create index for the table field which you are frequently using in where clause.  

Tuesday, March 6, 2012

How to get label or textbox control from .aspx page in .ascx user control page

 How to access controls from .aspx in .ascx user control page  
 Here i am showing a simple example how can we access controls from aspx in .ascx page  
 First i have created a WebUserControl.ascx user control page which contain a button.  
 WebUserControl.ascx page  
 <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>  
       <asp:Button ID="btn_addUC" runat="server" Text="Add" OnClick="btn_addUC_Click" />  
 Write below code in code behind   
 WebUserControl.ascx.cs page  
 protected void btn_addUC_Click(object sender, EventArgs e)  
      Button btnSender = (Button)sender;  
      Page parentPage = btnSender.Page;      
      TextBox txt = (TextBox)parentPage.FindControl("txtName");  
      Label lbl = (Label)parentPage.FindControl("lblNAme");  
      lbl.Text = txt.Text;  
 Take a another test_page.aspx page and register the above user control in given below:  
 test_page.aspx page  
 <form id="form1" runat="server">  
           <uc1:WebUserControl runat="server" ID="WebUserControl" />  
           <asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />  
           <asp:Label ID="lblNAme" runat="server" Text="Label"></asp:Label>  
      Run and test the application.  
 Santosh Singh