Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


How to find which control is HTML and Server when page is rendered.Because when page is rendered we get only HTML for a control there no runat=server.So how will find that this event was fired by Asp Button.please help me out.

Code at design Time
CSS
<asp:Button ID="btnLogin" runat="server" Text="Login" onclick="btnLogin_Click"  />
            <asp:Button ID="btnPrint" runat="server" Text="Print" 
             Height="29px"  
            style="font-weight: 700" Width="70px" onclick="btnPrint_Click" />
        <asp:Button ID="Button1" runat="server" onclientclick="javascript:get();" 
            Text="Button" onclick="Button1_Click" />
        <input id="htmlButton" type="button" value="button" /><input id="btnHtmlSubmit" 
            type="submit" value="submit" />


When page is rendered

<input type="submit" name="btnLogin" value="Login" id="btnLogin" />
<input type="submit" name="btnPrint" value="Print" id="btnPrint" style="height:29px;width:70px;font-weight: 700" />
<input type="submit" name="Button1" value="Button" önclick="javascript:get();" id="Button1" />
<input id="htmlButton" type="button" value="button" /><input id="btnHtmlSubmit"
type="submit" value="submit" />
Posted
Updated 19-Sep-12 19:14pm
v4
Comments
[no name] 19-Sep-12 14:55pm    
This is one of those questions where it is difficult to figure out what exactly you are trying to ask. You would know that the btnLogin button was clicked because the btnLogin_Click event handler would run.
Himanshu Yadav 19-Sep-12 23:34pm    
When we go for view source we can see only HTML for asp button and Html button.How we can distinguish between server button and html Button.

1 solution

The ClientID property of Asp.net controls is a automatically generated identification for a control. You should use ClientID to get the details about the controls when it is rendered. Refer the code for similar examples:
ASP.NET: How to Resolve Client ID[^]
ASP.NET 4.0 ClientID Overview[^]


--Amit
 
Share this answer
 
Comments
Rockstar_ 20-Sep-12 0:49am    
nice articles...
Himanshu Yadav 20-Sep-12 1:13am    
Nice......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900