<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Building A SPGridView Control &#8211; Intermezzo: TemplateFields and the RowCommand Event</title>
	<atom:link href="http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/</link>
	<description>Complexity through Simplicity</description>
	<lastBuildDate>Tue, 13 Jul 2010 07:25:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Erik Burger</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-108</link>
		<dc:creator>Erik Burger</dc:creator>
		<pubDate>Fri, 18 Dec 2009 15:17:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-108</guid>
		<description>Hi Vlad,

Yes, Shail resolved his issue by moving the DataBind() method our of the Render method and into CreateChildControls. See if that works for you. I will give you the same comment I did Shail (after congratulating him, of course ;)) and advice that you try to move the DataBind() method ahead in the lifecycle one method at a time. This because I am unsure as to whether CreateChildControls is the best place for it.

Let us know how you do!

Best of regards,

Erik</description>
		<content:encoded><![CDATA[<p>Hi Vlad,</p>
<p>Yes, Shail resolved his issue by moving the DataBind() method our of the Render method and into CreateChildControls. See if that works for you. I will give you the same comment I did Shail (after congratulating him, of course <img src='http://www.reversealchemy.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) and advice that you try to move the DataBind() method ahead in the lifecycle one method at a time. This because I am unsure as to whether CreateChildControls is the best place for it.</p>
<p>Let us know how you do!</p>
<p>Best of regards,</p>
<p>Erik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vlad</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-107</link>
		<dc:creator>Vlad</dc:creator>
		<pubDate>Fri, 18 Dec 2009 14:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-107</guid>
		<description>Hi,
I have the same problem Shail does: SPGridView.Rows.Count=0 in the event handler even though everything displays correctly on the page. Did you guys resolve this issue?
Thanks</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have the same problem Shail does: SPGridView.Rows.Count=0 in the event handler even though everything displays correctly on the page. Did you guys resolve this issue?<br />
Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shail</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-93</link>
		<dc:creator>Shail</dc:creator>
		<pubDate>Fri, 06 Nov 2009 09:48:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-93</guid>
		<description>Hey Erik,

I have sent you the code. Please check your inbox and have a look on the Spam folder if not found in the inbox :-)

Thanks Mate.</description>
		<content:encoded><![CDATA[<p>Hey Erik,</p>
<p>I have sent you the code. Please check your inbox and have a look on the Spam folder if not found in the inbox <img src='http://www.reversealchemy.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Thanks Mate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik Burger</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-92</link>
		<dc:creator>Erik Burger</dc:creator>
		<pubDate>Thu, 05 Nov 2009 19:25:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-92</guid>
		<description>Hi Shail,

Thank you very much for your compliment! In my experience there can be a lot of reasons why your scenario is not (yet) working. So yes, please send me your code and I will take a look at it as soon as I can. My e-mail address is  eburger at reversealchemy dot net.

Cheers,

Erik</description>
		<content:encoded><![CDATA[<p>Hi Shail,</p>
<p>Thank you very much for your compliment! In my experience there can be a lot of reasons why your scenario is not (yet) working. So yes, please send me your code and I will take a look at it as soon as I can. My e-mail address is  eburger at reversealchemy dot net.</p>
<p>Cheers,</p>
<p>Erik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shail</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-91</link>
		<dc:creator>Shail</dc:creator>
		<pubDate>Thu, 05 Nov 2009 18:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-91</guid>
		<description>Hi Erik,

First of all its and awesome post. And it worked as expected.
Now I would like to move directly to my problem as I am bit restless now.

I have a SPGridView embedded on a web part with following config:
1. Has got paging, sorting and data displayed from a DB view. All these things are configured in CreateChildControl function.
2. Data binding happens on Render() function of teh webpart.
3. A checkbox template column on the beginning of spgrid

I want my uses to be able to select multiple entried from the grid and click a button on the webpart. Then the grid will perform action on selected entried in the DB.

But, when i click any button embedded on the webpart, postback happens as expacted. when I try to surf the grid in the buttons click event handler, surprisingly I come to know that, the grid has got zero rows...

I tried everything like binding the grid again before checking the row count in button&#039;s event handler, But leads to fill recreation of the grid and all the changes I made to grid(checking the check boxes) are lost.

I need a place where I can see the status of checkboxes (after they are modified by user)and use them to call Stored procedure etc.

Any idea whats happenning with me ?
I can post you the code if you would like to have a look on the same.

Million Thanks in advance.
Shail.</description>
		<content:encoded><![CDATA[<p>Hi Erik,</p>
<p>First of all its and awesome post. And it worked as expected.<br />
Now I would like to move directly to my problem as I am bit restless now.</p>
<p>I have a SPGridView embedded on a web part with following config:<br />
1. Has got paging, sorting and data displayed from a DB view. All these things are configured in CreateChildControl function.<br />
2. Data binding happens on Render() function of teh webpart.<br />
3. A checkbox template column on the beginning of spgrid</p>
<p>I want my uses to be able to select multiple entried from the grid and click a button on the webpart. Then the grid will perform action on selected entried in the DB.</p>
<p>But, when i click any button embedded on the webpart, postback happens as expacted. when I try to surf the grid in the buttons click event handler, surprisingly I come to know that, the grid has got zero rows&#8230;</p>
<p>I tried everything like binding the grid again before checking the row count in button&#8217;s event handler, But leads to fill recreation of the grid and all the changes I made to grid(checking the check boxes) are lost.</p>
<p>I need a place where I can see the status of checkboxes (after they are modified by user)and use them to call Stored procedure etc.</p>
<p>Any idea whats happenning with me ?<br />
I can post you the code if you would like to have a look on the same.</p>
<p>Million Thanks in advance.<br />
Shail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik Burger</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-68</link>
		<dc:creator>Erik Burger</dc:creator>
		<pubDate>Wed, 29 Jul 2009 07:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-68</guid>
		<description>Hi Zeta,

Thanks! I am glad you found the post useful.

To add another button to a TemplateField row you can just add another instance of a button to the control in the InstantiateIn method. So something like this:

&lt;pre lang=&quot;csharp&quot;&gt;
LinkButton button = new LinkButton();
button.Text = &quot;One button&quot;;
button.DataBinding += new EventHandler( button_DataBinding );
container.Controls.Add( button );

// Add another button
LinkButton button2 = new LinkButton();
button2.Text = &quot;Another button&quot;;
button2.DataBinding += new EventHandler( button2_DataBinding );
container.Controls.Add( button2 );
&lt;/pre&gt;


Does this help? If I misunderstood your question please let me know. You can also drop me a line at eburger at reversealchemy dot net.

Regards,

Erik</description>
		<content:encoded><![CDATA[<p>Hi Zeta,</p>
<p>Thanks! I am glad you found the post useful.</p>
<p>To add another button to a TemplateField row you can just add another instance of a button to the control in the InstantiateIn method. So something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">LinkButton button <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LinkButton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
button.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;One button&quot;</span><span style="color: #008000;">;</span>
button.<span style="color: #0000FF;">DataBinding</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #000000;">&#40;</span> button_DataBinding <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
container.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> button <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Add another button</span>
LinkButton button2 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LinkButton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
button2.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Another button&quot;</span><span style="color: #008000;">;</span>
button2.<span style="color: #0000FF;">DataBinding</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #000000;">&#40;</span> button2_DataBinding <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
container.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> button2 <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Does this help? If I misunderstood your question please let me know. You can also drop me a line at eburger at reversealchemy dot net.</p>
<p>Regards,</p>
<p>Erik</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeta</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-65</link>
		<dc:creator>Zeta</dc:creator>
		<pubDate>Wed, 29 Jul 2009 04:18:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-65</guid>
		<description>Great post!

one question: how can add one more button into every templatefield row?

Looking forward to your answer!</description>
		<content:encoded><![CDATA[<p>Great post!</p>
<p>one question: how can add one more button into every templatefield row?</p>
<p>Looking forward to your answer!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://www.reversealchemy.net/blog/2009/07/08/building-a-spgridview-control-intermezzo-templatefields-and-the-rowcommand-event/comment-page-1/#comment-61</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Thu, 09 Jul 2009 08:35:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.reversealchemy.net/?p=215#comment-61</guid>
		<description>Well, it was obviously useful to me. So thanks again!
And of course my best wishes for your new career ...</description>
		<content:encoded><![CDATA[<p>Well, it was obviously useful to me. So thanks again!<br />
And of course my best wishes for your new career &#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
