<?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"
	>
<channel>
	<title>Comments on: Adding (or Inserting) Subheader Rows into a Gridview</title>
	<atom:link href="http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/</link>
	<description></description>
	<pubDate>Sat, 04 Feb 2012 12:34:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Rameez</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11368</link>
		<dc:creator>Rameez</dc:creator>
		<pubDate>Wed, 14 Dec 2011 15:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11368</guid>
		<description>Hi ,
I had the same problem Carl can you share the solution of Gridview Rows Coount issue on postback</description>
		<content:encoded><![CDATA[<p>Hi ,<br />
I had the same problem Carl can you share the solution of Gridview Rows Coount issue on postback</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vibhu Banga</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11367</link>
		<dc:creator>Vibhu Banga</dc:creator>
		<pubDate>Wed, 14 Dec 2011 13:14:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11367</guid>
		<description>Thank you so much for the help!!! Its a great article.</description>
		<content:encoded><![CDATA[<p>Thank you so much for the help!!! Its a great article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pierre Lefrancois</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11361</link>
		<dc:creator>Pierre Lefrancois</dc:creator>
		<pubDate>Thu, 01 Dec 2011 14:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11361</guid>
		<description>Hi Carl, thanks for your code, very useful for me. How to add the number of categories on each respective line. EX:
FastFood = 4, Italian = 3, etc.
Thank you for taking the time to answer me, it would be greatly useful for me.</description>
		<content:encoded><![CDATA[<p>Hi Carl, thanks for your code, very useful for me. How to add the number of categories on each respective line. EX:<br />
FastFood = 4, Italian = 3, etc.<br />
Thank you for taking the time to answer me, it would be greatly useful for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simflex</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11341</link>
		<dc:creator>Simflex</dc:creator>
		<pubDate>Mon, 17 Oct 2011 06:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11341</guid>
		<description>Greetings. Fanstac coding techniques.

I don't know if anyone is still responding to this post; I certainly hope so. I tried using this code to edit clien record with 7 rows.

The first row is edited and updated successfully.

Subsequent rows don't update.

Does anyone know what has to change in the code for this to happen?

Without this added code, the edit and update work pretty good.

Hoping to hear from someone.

Thanks alot in advance.</description>
		<content:encoded><![CDATA[<p>Greetings. Fanstac coding techniques.</p>
<p>I don&#8217;t know if anyone is still responding to this post; I certainly hope so. I tried using this code to edit clien record with 7 rows.</p>
<p>The first row is edited and updated successfully.</p>
<p>Subsequent rows don&#8217;t update.</p>
<p>Does anyone know what has to change in the code for this to happen?</p>
<p>Without this added code, the edit and update work pretty good.</p>
<p>Hoping to hear from someone.</p>
<p>Thanks alot in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stew</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11296</link>
		<dc:creator>Stew</dc:creator>
		<pubDate>Tue, 21 Jun 2011 11:59:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11296</guid>
		<description>What was the solution Carl? I've been racking my brain over this.</description>
		<content:encoded><![CDATA[<p>What was the solution Carl? I&#8217;ve been racking my brain over this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl Saiyed</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11268</link>
		<dc:creator>Carl Saiyed</dc:creator>
		<pubDate>Thu, 09 Dec 2010 19:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11268</guid>
		<description>I had the same problem above as Jeff and Justin. I was able to solve it today and will post the code needed shortly.</description>
		<content:encoded><![CDATA[<p>I had the same problem above as Jeff and Justin. I was able to solve it today and will post the code needed shortly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11267</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Wed, 01 Dec 2010 20:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11267</guid>
		<description>I had the same issue as JeffD. The problem is, the GridView count stays based on the number of DataSource rows. So, when looping back through on a postback, the rows in the HTML table of the GridView are out-of-sync with the DataItems.

Does anyone have a fix for this?

Carl, your solution doesn't seem to work because the GridView count is still off.</description>
		<content:encoded><![CDATA[<p>I had the same issue as JeffD. The problem is, the GridView count stays based on the number of DataSource rows. So, when looping back through on a postback, the rows in the HTML table of the GridView are out-of-sync with the DataItems.</p>
<p>Does anyone have a fix for this?</p>
<p>Carl, your solution doesn&#8217;t seem to work because the GridView count is still off.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pankaj kumar</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11239</link>
		<dc:creator>pankaj kumar</dc:creator>
		<pubDate>Thu, 01 Jul 2010 08:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11239</guid>
		<description>hello sir ur code is very good 4 filling gridview bt i hv textboxes in gv 2 insert data in database bt it is not retreiving correct rows from gridview plz tell me way to solve this problem 
itz urgent
reply will b highly appreciated</description>
		<content:encoded><![CDATA[<p>hello sir ur code is very good 4 filling gridview bt i hv textboxes in gv 2 insert data in database bt it is not retreiving correct rows from gridview plz tell me way to solve this problem<br />
itz urgent<br />
reply will b highly appreciated</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hubert</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11229</link>
		<dc:creator>Hubert</dc:creator>
		<pubDate>Thu, 20 May 2010 16:19:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11229</guid>
		<description>The solution for the rebind problem after postback, and for the loss of the e.CommandArgument content in the LinkButton, is : set EnableViewState="False" for the GridView. It worked for me.</description>
		<content:encoded><![CDATA[<p>The solution for the rebind problem after postback, and for the loss of the e.CommandArgument content in the LinkButton, is : set EnableViewState=&#8221;False&#8221; for the GridView. It worked for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miroslav</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11224</link>
		<dc:creator>Miroslav</dc:creator>
		<pubDate>Sun, 09 May 2010 16:04:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11224</guid>
		<description>I found the solution for pager problem, and somebody else can explain why is it happening (I don't know). Anyway instead of 
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
just define as 
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);
and that should do the trick</description>
		<content:encoded><![CDATA[<p>I found the solution for pager problem, and somebody else can explain why is it happening (I don&#8217;t know). Anyway instead of<br />
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);<br />
just define as<br />
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);<br />
and that should do the trick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sathieshkumar.R</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11219</link>
		<dc:creator>Sathieshkumar.R</dc:creator>
		<pubDate>Fri, 23 Apr 2010 07:09:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11219</guid>
		<description>hi i am using the above code, working well. I am using LinkButton in the gridview through this i will popup a window. My problem is the links in the bottom n number is not working. where n is the number of sub headings in the gridview. Please help me to solve this.

Thanks in advance.

Regards,
Sathieshkumar .R</description>
		<content:encoded><![CDATA[<p>hi i am using the above code, working well. I am using LinkButton in the gridview through this i will popup a window. My problem is the links in the bottom n number is not working. where n is the number of sub headings in the gridview. Please help me to solve this.</p>
<p>Thanks in advance.</p>
<p>Regards,<br />
Sathieshkumar .R</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anitha</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11203</link>
		<dc:creator>Anitha</dc:creator>
		<pubDate>Sat, 30 Jan 2010 08:21:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11203</guid>
		<description>Hi,
  I have used the above code and facing some problem in data retrieval.I am getting wrong values from the rows.Could you please send me the full code with retrieval .</description>
		<content:encoded><![CDATA[<p>Hi,<br />
  I have used the above code and facing some problem in data retrieval.I am getting wrong values from the rows.Could you please send me the full code with retrieval .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Spahn</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11192</link>
		<dc:creator>Chris Spahn</dc:creator>
		<pubDate>Fri, 04 Dec 2009 11:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11192</guid>
		<description>Carl, Phil, JeffD, anyone: Has anyone solved the rebind problem??  I need a fix ASAP. I've been at this for 12 hours straight.  PLEASE let me know if you know of a work-around for this.

Thanks!</description>
		<content:encoded><![CDATA[<p>Carl, Phil, JeffD, anyone: Has anyone solved the rebind problem??  I need a fix ASAP. I&#8217;ve been at this for 12 hours straight.  PLEASE let me know if you know of a work-around for this.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Coons</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11190</link>
		<dc:creator>Phil Coons</dc:creator>
		<pubDate>Mon, 16 Nov 2009 20:08:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11190</guid>
		<description>Did anyone find a solution to the rebind problem after postback described by JeffD above? I am having that exact problem and I have spent several days trying to figure out a way around this.  Any body have any ideas, Help!!</description>
		<content:encoded><![CDATA[<p>Did anyone find a solution to the rebind problem after postback described by JeffD above? I am having that exact problem and I have spent several days trying to figure out a way around this.  Any body have any ideas, Help!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jo Kvalvaag</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11186</link>
		<dc:creator>Jo Kvalvaag</dc:creator>
		<pubDate>Thu, 24 Sep 2009 15:16:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11186</guid>
		<description>Hello! Thank you for this post. I have used a similar technique to add row spans on cells where data is repeated in a user control I've made. However, this control will not render the added sub-header rows.

I have a bit of a complicated structure with a user control containing the grid being added to a ajaxToolkit TabContainer in an other user control. And due to a bug (I believe) in the TabContainer control, I have to databind the grid during the init event of the tabcontainer, and not during the pageload event. I think this would be the reason that the rows are never rendered.

Databinding the gridview on pageload will not work with the tab control. You wouldn't have a workaround to suggest for this, would you?</description>
		<content:encoded><![CDATA[<p>Hello! Thank you for this post. I have used a similar technique to add row spans on cells where data is repeated in a user control I&#8217;ve made. However, this control will not render the added sub-header rows.</p>
<p>I have a bit of a complicated structure with a user control containing the grid being added to a ajaxToolkit TabContainer in an other user control. And due to a bug (I believe) in the TabContainer control, I have to databind the grid during the init event of the tabcontainer, and not during the pageload event. I think this would be the reason that the rows are never rendered.</p>
<p>Databinding the gridview on pageload will not work with the tab control. You wouldn&#8217;t have a workaround to suggest for this, would you?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jax olofsson</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11176</link>
		<dc:creator>jax olofsson</dc:creator>
		<pubDate>Tue, 05 May 2009 13:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11176</guid>
		<description>Hi Carl .Thanks for the solution. Im doing training and inspection forms so that code u provided was a big help.. i just made one change,, instead of referring to the gridview by name u reffrreed it using the sender object.. i rewrote in VB so here 

Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
        ' this will add a row header every time the itemgroup changes!
        If (e.Row.RowType = DataControlRowType.DataRow) Then
            Dim drv As DataRowView = CType(e.Row.DataItem, DataRowView)
            If (tmpItemGroup  drv("Itemgroup").ToString) Then
                tmpItemGroup = drv("ItemGroup")
                Dim tbl As Table = CType(e.Row.Parent, Table)
                Dim row As GridViewRow = New GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal)
                Dim cell As TableCell = New TableCell()
                cell.ColumnSpan = sender.Columns.Count
                cell.Width = Unit.Percentage(100)
                cell.Style.Add("font-weight", "bold")
                Dim span As HtmlGenericControl = New HtmlGenericControl("span")
                span.InnerHtml = tmpItemGroup
                cell.Controls.Add(span)
                row.Cells.Add(cell)
                tbl.Rows.AddAt(tbl.Rows.Count - 1, row)
            End If
        End If
    End Sub</description>
		<content:encoded><![CDATA[<p>Hi Carl .Thanks for the solution. Im doing training and inspection forms so that code u provided was a big help.. i just made one change,, instead of referring to the gridview by name u reffrreed it using the sender object.. i rewrote in VB so here </p>
<p>Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)<br />
        &#8216; this will add a row header every time the itemgroup changes!<br />
        If (e.Row.RowType = DataControlRowType.DataRow) Then<br />
            Dim drv As DataRowView = CType(e.Row.DataItem, DataRowView)<br />
            If (tmpItemGroup  drv(&#8221;Itemgroup&#8221;).ToString) Then<br />
                tmpItemGroup = drv(&#8221;ItemGroup&#8221;)<br />
                Dim tbl As Table = CType(e.Row.Parent, Table)<br />
                Dim row As GridViewRow = New GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal)<br />
                Dim cell As TableCell = New TableCell()<br />
                cell.ColumnSpan = sender.Columns.Count<br />
                cell.Width = Unit.Percentage(100)<br />
                cell.Style.Add(&#8221;font-weight&#8221;, &#8220;bold&#8221;)<br />
                Dim span As HtmlGenericControl = New HtmlGenericControl(&#8221;span&#8221;)<br />
                span.InnerHtml = tmpItemGroup<br />
                cell.Controls.Add(span)<br />
                row.Cells.Add(cell)<br />
                tbl.Rows.AddAt(tbl.Rows.Count - 1, row)<br />
            End If<br />
        End If<br />
    End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ron Liu</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11175</link>
		<dc:creator>Ron Liu</dc:creator>
		<pubDate>Mon, 04 May 2009 05:29:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11175</guid>
		<description>This is a very clever way to add sub-headers to the gridview. However, I ran into a problem. When I click on some button which causing a postback. On postback, it seems the GridView gets rebind to the ViewState without calling calling the RowDataBound event. As a result, the subheaders lost on postback. Is there any fix to this problem?

Thanks

Ron</description>
		<content:encoded><![CDATA[<p>This is a very clever way to add sub-headers to the gridview. However, I ran into a problem. When I click on some button which causing a postback. On postback, it seems the GridView gets rebind to the ViewState without calling calling the RowDataBound event. As a result, the subheaders lost on postback. Is there any fix to this problem?</p>
<p>Thanks</p>
<p>Ron</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: velmurugan</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11147</link>
		<dc:creator>velmurugan</dc:creator>
		<pubDate>Mon, 12 Jan 2009 13:12:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11147</guid>
		<description>yes sir its due empty argument</description>
		<content:encoded><![CDATA[<p>yes sir its due empty argument</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11146</link>
		<dc:creator>Carl J</dc:creator>
		<pubDate>Wed, 07 Jan 2009 11:31:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11146</guid>
		<description>@Velmurugan: What did you do to fix it? Was the problem because of the empty CommandArgument?</description>
		<content:encoded><![CDATA[<p>@Velmurugan: What did you do to fix it? Was the problem because of the empty CommandArgument?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Velmurugan</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11145</link>
		<dc:creator>Velmurugan</dc:creator>
		<pubDate>Wed, 07 Jan 2009 10:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11145</guid>
		<description>thank u sir... i rectified the error.. thanks for ur coding</description>
		<content:encoded><![CDATA[<p>thank u sir&#8230; i rectified the error.. thanks for ur coding</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11144</link>
		<dc:creator>Carl J</dc:creator>
		<pubDate>Sun, 04 Jan 2009 12:48:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11144</guid>
		<description>@JeffD: Have you had any luck? A few weeks ago I was playing around with the GridView, and had a similar problem. The last few weeks have been super busy with Xmas and all, so I haven't had a chance to look into it some more.</description>
		<content:encoded><![CDATA[<p>@JeffD: Have you had any luck? A few weeks ago I was playing around with the GridView, and had a similar problem. The last few weeks have been super busy with Xmas and all, so I haven&#8217;t had a chance to look into it some more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl J</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11143</link>
		<dc:creator>Carl J</dc:creator>
		<pubDate>Sun, 04 Jan 2009 12:47:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11143</guid>
		<description>@Velmurugan: I'm going out on a limb here, and kind of guessing, since I don't have the rest of your code.

In Btnedit_Command(), you're saving the value of e.CommandArgument into IdStr, however, in your aspx page, you're not setting the value of the CommandArgument property, unless that's being done in the DataBound.</description>
		<content:encoded><![CDATA[<p>@Velmurugan: I&#8217;m going out on a limb here, and kind of guessing, since I don&#8217;t have the rest of your code.</p>
<p>In Btnedit_Command(), you&#8217;re saving the value of e.CommandArgument into IdStr, however, in your aspx page, you&#8217;re not setting the value of the CommandArgument property, unless that&#8217;s being done in the DataBound.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Velmurugan</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11114</link>
		<dc:creator>Velmurugan</dc:creator>
		<pubDate>Sat, 27 Dec 2008 09:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11114</guid>
		<description>your coding is pretty good and understandable... but i have problem in paging where the paging displays in first cell. moreover i added one link button in gridview column which will redirect to another page.. for the first link its not working and i cant get the id.. help me here is the coding...

  
                                                                            
			                                                                
			                                                                    
			                                                                        
			                                                                            &#60;asp:HiddenField ID="Hidparentid" runat="server" Value='' /&#62;
			                                                                        
			                                                                    
			                                                                    
			                                                                    
			                                                                        
			                                                                            &#60;asp:LinkButton ID="LBEdit" Text='' runat="server"  CommandArgument='' OnCommand="Btnedit_Command" &#62;
			                                                                        
			                                                                        &#60;%--
                                                                                        &#60;a id="A1" href="javascript:fnEdit('');" runat="server"&#62; &#60;asp:Label runat="server" ID="LblName" Text=''&#62; 
                                                                                    --%&#62;
			                                                                     
			                                                                    
			                                                                        
			                                                                            &#60;asp:Label ID="Lblaccount" text='' runat="server"&#62;
			                                                                        
			                                                                    
			                                                                    
			                                                                        
			                                                                            
			                                                                        
			                                                                    
			                                                                      
			                                                                        
			                                                                            
			                                                                        
			                                                                    
			                                                                     
		                                                                                
		                                                                                    &#160;&#60;asp:Label ID="lblJob" runat="server" Text=''&#62;
		                                                                                
		                                                                            
			                                                                    
			                                                                        
			                                                                            &#60;asp:TextBox ID="hidAmount" runat="server" Text='' /&#62;
			                                                                            &#60;asp:HiddenField ID="hidAccType" runat="server" Value='' /&#62;
			                                                                            &#60;asp:TextBox ID="hidmemo" runat="server" Text=''&#62;
			                                                                           
			                                                                        
			                                                                    
			                                                                
	                                                                            
                                                                                
                                                                                
                                                                                
                                                                                
			                                                            


in .cs file 


 protected void Btnedit_Command(object sender, CommandEventArgs e)
    {
        try
        {
            String IdStr = System.Convert.ToString(e.CommandArgument);
            Response.Cookies["purchaseid"].Value = IdStr;
            Response.Redirect("purchases.aspx");
        }
}</description>
		<content:encoded><![CDATA[<p>your coding is pretty good and understandable&#8230; but i have problem in paging where the paging displays in first cell. moreover i added one link button in gridview column which will redirect to another page.. for the first link its not working and i cant get the id.. help me here is the coding&#8230;</p>
<p>			                                                                            &lt;asp:HiddenField ID=&#8221;Hidparentid&#8221; runat=&#8221;server&#8221; Value=&#8221; /&gt;</p>
<p>			                                                                            &lt;asp:LinkButton ID=&#8221;LBEdit&#8221; Text=&#8221; runat=&#8221;server&#8221;  CommandArgument=&#8221; OnCommand=&#8221;Btnedit_Command&#8221; &gt;</p>
<p>			                                                                        &lt;%&#8211;<br />
                                                                                        &lt;a id=&#8221;A1&#8243; href=&#8221;javascript:fnEdit(&#8221;);&#8221; runat=&#8221;server&#8221;&gt; &lt;asp:Label runat=&#8221;server&#8221; ID=&#8221;LblName&#8221; Text=&#8221;&gt;<br />
                                                                                    &#8211;%&gt;</p>
<p>			                                                                            &lt;asp:Label ID=&#8221;Lblaccount&#8221; text=&#8221; runat=&#8221;server&#8221;&gt;</p>
<p>		                                                                                    &nbsp;&lt;asp:Label ID=&#8221;lblJob&#8221; runat=&#8221;server&#8221; Text=&#8221;&gt;</p>
<p>			                                                                            &lt;asp:TextBox ID=&#8221;hidAmount&#8221; runat=&#8221;server&#8221; Text=&#8221; /&gt;<br />
			                                                                            &lt;asp:HiddenField ID=&#8221;hidAccType&#8221; runat=&#8221;server&#8221; Value=&#8221; /&gt;<br />
			                                                                            &lt;asp:TextBox ID=&#8221;hidmemo&#8221; runat=&#8221;server&#8221; Text=&#8221;&gt;</p>
<p>in .cs file </p>
<p> protected void Btnedit_Command(object sender, CommandEventArgs e)<br />
    {<br />
        try<br />
        {<br />
            String IdStr = System.Convert.ToString(e.CommandArgument);<br />
            Response.Cookies["purchaseid"].Value = IdStr;<br />
            Response.Redirect(&#8221;purchases.aspx&#8221;);<br />
        }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JeffD</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11011</link>
		<dc:creator>JeffD</dc:creator>
		<pubDate>Tue, 16 Dec 2008 16:18:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11011</guid>
		<description>I've been playing around a bit more, but still haven't had any luck.  I put two labels on the form and update them with gridview.Rows.Count and tbl.Rows.Count in the RowDataBound event just for testing purposes.  The gridview reports 43 rows, and the table 53 when the page is fully loaded (even though I only see 52 rows even in page source).  In the button click event I check the counts right away.  The gridview count is still 43, but the table count drops to just 45.  This is where it's "broken" because I can't reference all of the rows.  

If I just let the postback run through, the grid redraws without the new rows (which I guess makes sense because they were drawn after the databind which is only done if not a postback in the page load).  Where the new rows were originally added, there is no data--that is, the data remained in the original row positions, but some of the data I entered in fields moved up.  Kinda messy, and I'm not sure how to work around this yet.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been playing around a bit more, but still haven&#8217;t had any luck.  I put two labels on the form and update them with gridview.Rows.Count and tbl.Rows.Count in the RowDataBound event just for testing purposes.  The gridview reports 43 rows, and the table 53 when the page is fully loaded (even though I only see 52 rows even in page source).  In the button click event I check the counts right away.  The gridview count is still 43, but the table count drops to just 45.  This is where it&#8217;s &#8220;broken&#8221; because I can&#8217;t reference all of the rows.  </p>
<p>If I just let the postback run through, the grid redraws without the new rows (which I guess makes sense because they were drawn after the databind which is only done if not a postback in the page load).  Where the new rows were originally added, there is no data&#8211;that is, the data remained in the original row positions, but some of the data I entered in fields moved up.  Kinda messy, and I&#8217;m not sure how to work around this yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlj</title>
		<link>http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11010</link>
		<dc:creator>carlj</dc:creator>
		<pubDate>Mon, 15 Dec 2008 17:07:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.carlj.ca/2008/04/20/adding-or-inserting-subheader-rows-into-a-gridview/#comment-11010</guid>
		<description>Hey Jeff, it's been a while since I did this. Let me try to look at it tonight, and I'll get back to you. I know that when I originally did this (before posting), I had to go through each row.

What if you did something like the following:

for (int i = 0; i &lt; gvTests.Rows.Count; i++)
{
     if(gvTests.Rows[i].RowType == DataControlRowType.DataRow)
     {
          TextBox txtQty = (TextBox)gvTests.Rows[i].FindControl(”txtQuantity”);

          if(txtQty != null)
          {
             // Do something with txtQty
          }
     }
}

The only difference, is that you check to see if the txtQty is null or not. When you get to a Sub Header row, the Textbox doesn't exist, so it'll be null.</description>
		<content:encoded><![CDATA[<p>Hey Jeff, it&#8217;s been a while since I did this. Let me try to look at it tonight, and I&#8217;ll get back to you. I know that when I originally did this (before posting), I had to go through each row.</p>
<p>What if you did something like the following:</p>
<p>for (int i = 0; i < gvTests.Rows.Count; i++)<br />
{<br />
     if(gvTests.Rows[i].RowType == DataControlRowType.DataRow)<br />
     {<br />
          TextBox txtQty = (TextBox)gvTests.Rows[i].FindControl(”txtQuantity”);</p>
<p>          if(txtQty != null)<br />
          {<br />
             // Do something with txtQty<br />
          }<br />
     }<br />
}</p>
<p>The only difference, is that you check to see if the txtQty is null or not. When you get to a Sub Header row, the Textbox doesn&#8217;t exist, so it&#8217;ll be null.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

