RSS
 

Archive for the ‘asp.net’ Category

Know the control which caused the postback

23 Jan

I got this from some site. It can be used to know the control which caused the postback.

 public static Control GetPostBackControl(Page thePage)
    {
        Control myControl = null;
        string ctrlName = thePage.Request.Params.Get(“__EVENTTARGET”);
        if (((ctrlName != null) & (ctrlName != string.Empty)))
        {
            myControl = thePage.FindControl(ctrlName);
        }
        else
        {
            foreach (string Item in thePage.Request.Form)
            {
                Control c = thePage.FindControl(Item);
                if (((c) is System.Web.UI.WebControls.Button))
                {
                    myControl = c;
                }
            }

        }
        return myControl;
    }

 
 

Limit in Argument size for functions

23 Jan

I was trying to insert data to a sql table from code behind.  But, when I tried to see the values using break point, I was not able to see the values. The following link shows the cause and reason.
Help Link

 
 

How to Register User Controls and Custom Controls in Web.config

23 Jan

If we register controls in the web.config, we don’t have to register the control on each page. This is useful, if we have to use the same control on several pages.

Help Link

 
 

Wizard Control in Asp.net

23 Jan

Use wizard control in asp.net to give a step by step entry form.
override default buttons using the templates. The sidebar link must be given in a datalist
 
        

          
           
               
                   
                 

                
                       

   

 
       
            ValidationGroup=”AddCandidateVal” />
        
            ValidationGroup=”AddCandidateVal” OnClientClick=”return confirm(‘Are you sure you want to submit this information?’);” OnClick=”startfinishbuttonclick” />   
           
   

Help Link