Click here to Skip to main content
11,492,914 members (61,317 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
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
<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 19-Sep-12 9:32am
Edited 19-Sep-12 20:14pm
v4
Comments
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
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
VijayChauhan123 at 20-Sep-12 0:49am
   
nice articles...
Himanshu Yadav at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 419
1 Maciej Los 286
2 F-ES Sitecore 224
3 KarstenK 210
4 CPallini 208
0 Sergey Alexandrovich Kryukov 10,132
1 OriginalGriff 8,630
2 Sascha Lefèvre 3,624
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web01 | 2.8.150520.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