Click here to Skip to main content
11,576,667 members (60,636 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0

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
<asp:Button ID="btnLogin" runat="server" Text="Login" onclick="btnLogin_Click"  />
            <asp:Button ID="btnPrint" runat="server" Text="Print" 
            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 19-Sep-12 8:32am
Edited 19-Sep-12 19:14pm
Wes Aday at 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 at 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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The ClientID property of 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[^]

VijayChauhan123 at 20-Sep-12 0:49am
nice articles...
Himanshu Yadav at 20-Sep-12 1:13am

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 251
1 Abhinav S 170
2 DamithSL 105
3 Lucifier Rocks 105
4 Dave Kreskowiak 80
0 OriginalGriff 715
1 Sergey Alexandrovich Kryukov 631
2 Abhinav S 528
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 365

Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100