<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Client Side Web Development</title><link>http://forums.asp.net/130.aspx</link><description>Client-side programming discussions, including CSS, DHTML, JScript/Javascript, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=18&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2378504.aspx</link><pubDate>Sat, 24 May 2008 14:23:38 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2378504</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2378504.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2378504</wfw:commentRss><description>&lt;p&gt;Well, you did not tell us that. The ClientID of the CheckBox (ID to use in client-side functionality)&amp;nbsp;will still be mangled though and that is why your way won&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;NC...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2377412.aspx</link><pubDate>Fri, 23 May 2008 17:47:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2377412</guid><dc:creator>saqib_dotnet</dc:creator><author>saqib_dotnet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2377412.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2377412</wfw:commentRss><description>&lt;p&gt;i m kind of disagree here because the checkbox i m trying to access is in the HEader of Gridview....It will be only one checkbox...Its not part of rows...&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2377349.aspx</link><pubDate>Fri, 23 May 2008 17:13:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2377349</guid><dc:creator>suyog.dabhole</dc:creator><author>suyog.dabhole</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2377349.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2377349</wfw:commentRss><description>&lt;p&gt;You have added check box in grid view at design time,suppose you binds 20 rows to grid view that mean 20 check boxes finally get added to your final rendered page.And in your code your are accessing directly checkbox id which is not possible.&lt;/p&gt;
&lt;p&gt;If you add check box out of grid view your code definilty work because final rendered page only contains one check box,but when you add it grid view until you bind data to it one can not predict no of check boxes in it.&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2377314.aspx</link><pubDate>Fri, 23 May 2008 17:00:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2377314</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2377314.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2377314</wfw:commentRss><description>&lt;p&gt;Because there is a Checkbox2 control declared for each row in the Grid, which makes the ID if each something like: &amp;#39;GridView1_ctl&amp;quot; + rowNumber + &amp;quot;_Checkbox2&amp;#39; which &amp;lt;%=Checkbox2.ClientID%&amp;gt; can&amp;#39;t unscramble. The way that I posted is the correct way of dealing with GridViews, DataGrids, etc.&lt;/p&gt;
&lt;p&gt;NC...&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2377045.aspx</link><pubDate>Fri, 23 May 2008 15:06:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2377045</guid><dc:creator>saqib_dotnet</dc:creator><author>saqib_dotnet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2377045.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2377045</wfw:commentRss><description>&lt;p&gt;The above code certainly works...but would you please tell me why the method i was trying didnt work...&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2377020.aspx</link><pubDate>Fri, 23 May 2008 14:56:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2377020</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2377020.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2377020</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Add to your GridView:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;asp:GridView ID=&amp;quot;GridView1&amp;quot; OnRowDataBound=&amp;quot;GridView1_RowDataBound&amp;quot; ...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Change your JavaScript to this:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;function onCheckbox2Click(chkbox)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;// Don&amp;#39;t need this as it is being passed by the event...&lt;br /&gt;&amp;nbsp;//var chkbox = document.getElementById(&amp;#39;&amp;lt;%=Checkbox2.ClientID%&amp;gt;&amp;#39;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;// Rest of your code goes here...&lt;br /&gt;}&lt;br /&gt;// --&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Add to the CodeBehind:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if ( e.Row.RowType == DataControlRowType.DataRow )&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;// CheckBox with an ID of &amp;quot;Checkbox2&amp;quot; is in column #1 of the Grid...&lt;br /&gt;&amp;nbsp;&amp;nbsp;Button checkBox2 = (Button)e.Row.Cells[1].FindControl(&amp;quot;Checkbox2&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;if ( checkBox2 != null )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;checkBox2.Attributes.Add(&amp;quot;onclick&amp;quot;, &amp;quot;onCheckbox2Click(this);&amp;quot;);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;NC...&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2376942.aspx</link><pubDate>Fri, 23 May 2008 14:29:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2376942</guid><dc:creator>saqib_dotnet</dc:creator><author>saqib_dotnet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2376942.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2376942</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;suyog.dabhole:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;Hi from page view source get id of check box like this.&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&lt;/font&gt;var&lt;font size="2"&gt; chkbox = document.getElementById(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;ctl00_MainContentPlaceHolder_GridView1_ctl03_Checkbox2&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thats why i did document.getelementbyid(&amp;#39;&amp;lt;%= Checkbox2.ClientID %&amp;gt;&amp;#39;), so i would get the cleint id.&lt;/p&gt;
&lt;p&gt;my soucre code is :&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;TemplateField&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;HeaderText&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;View Report&amp;quot;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;HeaderTemplate&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;span&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;font size="2"&gt;View Report&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;span&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;CheckBox&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;ID&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;cbSelectAll&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;runat&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;server&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;/&amp;gt; &lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;HeaderTemplate&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;ItemTemplate&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;CheckBox&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;ID&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;Checkbox2&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;runat&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;server&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;name&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;Checkbox2&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---HEERE&amp;nbsp; IS CHECKBOX2 IS DECLARED.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;ItemTemplate&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;TemplateField&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2376367.aspx</link><pubDate>Fri, 23 May 2008 10:40:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2376367</guid><dc:creator>suyog.dabhole</dc:creator><author>suyog.dabhole</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2376367.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2376367</wfw:commentRss><description>&lt;p&gt;Hi from page view source get id of check box like this.&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&lt;/font&gt;var&lt;font size="2"&gt; chkbox = document.getElementById(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;ctl00_MainContentPlaceHolder_GridView1_ctl03_Checkbox2&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;for each row different id page will genrate id&amp;#39;s it depends upon no of row you bind to grid view.&lt;/p&gt;
&lt;p&gt;In your code it looks that at design time you have added check box in side grid so it difficult get direct client id.&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2376333.aspx</link><pubDate>Fri, 23 May 2008 10:20:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2376333</guid><dc:creator>KashifB</dc:creator><author>KashifB</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2376333.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2376333</wfw:commentRss><description>&lt;p&gt;Do you have the JavaScript in the .aspx page or in a separate file?&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s in a separate file this method will not work and also using this method you will have to use the FindControl method of the GridView to find the Checkbox control and get it&amp;#39; Client ID.&lt;/p&gt;</description></item><item><title>Re: Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2376325.aspx</link><pubDate>Fri, 23 May 2008 10:16:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2376325</guid><dc:creator>suyog.dabhole</dc:creator><author>suyog.dabhole</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2376325.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2376325</wfw:commentRss><description>&lt;p&gt;Hi post you code so we&amp;nbsp;can monitor it&lt;/p&gt;</description></item><item><title>Access gridview's Checkbox control in JS</title><link>http://forums.asp.net/thread/2374682.aspx</link><pubDate>Thu, 22 May 2008 16:54:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2374682</guid><dc:creator>saqib_dotnet</dc:creator><author>saqib_dotnet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2374682.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2374682</wfw:commentRss><description>&lt;p&gt;Hello all, &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; How can i access the checkbox declared inside the Gridview using JS? i tried:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;var&lt;/font&gt;&lt;font size="2"&gt; chkbox = document.getElementById(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;lt;%=Checkbox2.ClientID%&amp;gt;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;and i got error, couldnt find checkbox2.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>