Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 15th, 2012  |  syntax: None  |  size: 0.84 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Dynamic control ID generation of ContentPage
  2. <pages clientIDMode="Static"></pages>
  3.        
  4. //ctl00$Cntnt$Button1 name works but its dynamically created
  5.        if (ScriptManager1.AsyncPostBackSourceElementID == "Button1")
  6.         {
  7.             Label1.Text = "Async PostBack occured @ " + DateTime.Now.ToLongTimeString();
  8.         }
  9.        
  10. <asp:Button ID="Button1" runat="server" Text="Refresh me" onclick="Button1_Click" />
  11.        
  12. <input type="submit" name="ctl00$Cntnt$Button1" value="Refresh me" id="Button1" />
  13.        
  14. if (ScriptManager1.AsyncPostBackSourceElementID == Button1.UniqueID)
  15. {
  16.     //do whatever
  17. }
  18.        
  19. <asp:Panel ID="Panel1" runat="server">
  20.     <asp:Label ID="Label1" runat="server" />
  21. </asp:Panel>
  22.        
  23. <span id="ctl00_Panel1_Label1"></span>
  24.        
  25. var labelText = Label1.Text;
  26.        
  27. var labelText = document.getElementById("<%=Label1.ClientID%>").innerText;