Click here to Skip to main content
12,761,707 members (37,560 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# 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 9:32am
Updated 19-Sep-12 20:14pm
Wes Aday 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

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 20-Sep-12 0:49am
nice articles...
Himanshu Yadav 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2017
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