Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi frds,

I am trying access a control on button click that is dynamically created by Ajax call, and rendering on browser with document.ready event.

I am not able to access it on button_click event.

Actually i am returning whole below code through Jquery response on .aspx page

<ul><li><input id="chk1" type="checkbox" name="chk1"></li></ul>


and rendring it like that

$(".Columns").html(obj.d);</pre>


but in .cs file i am not able to access "chk1", please suggest.

Thanks in advanced.
Posted
Updated 5-Sep-12 17:50pm
v4
Comments
Sergey Alexandrovich Kryukov 5-Sep-12 14:05pm    
It is not accessible probably because by some reason you are unable to take care about such a simple thing as spelling and capitalization. What's "conmtrol"? "chek"?! Even the patience of C# and Javascript translators are limited. :-)
--SA
[no name] 5-Sep-12 14:58pm    
"i am not able to access "chek1", your question is not really too clear but you defined your checkbox as "chk1" not "chek1".
virang_21 5-Sep-12 21:51pm    
missing runat="server" ? .. also check control ID you are trying to retrieve in button click event ..

If you using AJAX to return the HTML of the button like you mentioned above ,then you'll not be able to access the same in the server side.

It is just the HTML transferred from Server to Browser and not a normal control which was rendered on the Page load event or post back event.

By the way you need to have separation of concerns in your code.

Why you need half of the processing login in client side and remaining in the server side?
 
Share this answer
 
hi...

you should set the property runat="server" for your control...
 
Share this answer
 
try to add
ASP.NET
<ul><li><input id="chk1" type="checkbox" name="chk1" runat="server"></li></ul>
 
Share this answer
 

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

  Print Answers RSS


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