<?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: Gridview Hidden Field,How to get hidden field value in gridview,DataKeys</title>
	<atom:link href="http://blog.joggee.com/index.php?feed=rss2&#038;p=77" rel="self" type="application/rss+xml" />
	<link>http://blog.joggee.com/?p=77</link>
	<description>ASP.NET,VB.NET,C#.NET,SQL SERVER,DATABASE,XML,WEBSERVICES,JAVA,SOFTWARE,PROGRAMMING,MANAGEMENT</description>
	<lastBuildDate>Wed, 03 Feb 2010 02:47:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joggee</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-167</link>
		<dc:creator>Joggee</dc:creator>
		<pubDate>Wed, 25 Jun 2008 06:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-167</guid>
		<description>Danial Asked.&quot;&quot;&quot;&quot;&quot;&quot;
Dim intNewStock As Integer = GridView1.DataKeys(”New_Stock”).Value
Dim intTaked As Integer = GridView1.DataKeys(”Taked”).Value
Dim intReturn As Integer = GridView1.DataKeys(”Return_by_Vendor”).Value
Dim intStockB As Integer = GridView1.DataKeys(”Balance_Stock”).Value
Dim intStockP As Integer = GridView1.DataKeys(”Percent_Stock”).Value

intStockB = (intNewStock - intTaked) + intReturn
intStockP = intStockB / intNewStock * 100

(I have put this code in my update template inside the grid view, i was hoping it would add the fields that i wanted and show on fields i wanted but it didnt happen anyone can help &gt; 
Thanks in advance!

Reply::::::::::::::::::::::::
At 

Protected Sub gvdVIEW_RowDataBound(
If e.Row().RowIndex  -1 Then
      Try
        Dim lti As Literal
        Dim inttotal As Integer = 0

        lti = e.Row.FindControl(&quot;total&quot;)

        Dim int As Integer = 0
        For int = 1 To 5

          If e.Row.Cells(int).Text  &quot;0&quot; Then
            inttotal = inttotal + e.Row.Cells(int).Text
          Else
            e.Row.Cells(int).Text = String.Empty
          End If

        Next
        lti.Text = inttotal

      Catch ex As Exception

      End Try
    End If


Please fix loop index as per your coding.
It will work.

Joggee</description>
		<content:encoded><![CDATA[<p>Danial Asked.&#8221;"&#8221;"&#8221;"<br />
Dim intNewStock As Integer = GridView1.DataKeys(”New_Stock”).Value<br />
Dim intTaked As Integer = GridView1.DataKeys(”Taked”).Value<br />
Dim intReturn As Integer = GridView1.DataKeys(”Return_by_Vendor”).Value<br />
Dim intStockB As Integer = GridView1.DataKeys(”Balance_Stock”).Value<br />
Dim intStockP As Integer = GridView1.DataKeys(”Percent_Stock”).Value</p>
<p>intStockB = (intNewStock &#8211; intTaked) + intReturn<br />
intStockP = intStockB / intNewStock * 100</p>
<p>(I have put this code in my update template inside the grid view, i was hoping it would add the fields that i wanted and show on fields i wanted but it didnt happen anyone can help &gt;<br />
Thanks in advance!</p>
<p>Reply::::::::::::::::::::::::<br />
At </p>
<p>Protected Sub gvdVIEW_RowDataBound(<br />
If e.Row().RowIndex  -1 Then<br />
      Try<br />
        Dim lti As Literal<br />
        Dim inttotal As Integer = 0</p>
<p>        lti = e.Row.FindControl(&#8221;total&#8221;)</p>
<p>        Dim int As Integer = 0<br />
        For int = 1 To 5</p>
<p>          If e.Row.Cells(int).Text  &#8220;0&#8243; Then<br />
            inttotal = inttotal + e.Row.Cells(int).Text<br />
          Else<br />
            e.Row.Cells(int).Text = String.Empty<br />
          End If</p>
<p>        Next<br />
        lti.Text = inttotal</p>
<p>      Catch ex As Exception</p>
<p>      End Try<br />
    End If</p>
<p>Please fix loop index as per your coding.<br />
It will work.</p>
<p>Joggee</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arup</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-51</link>
		<dc:creator>Arup</dc:creator>
		<pubDate>Sun, 20 Apr 2008 21:37:45 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-51</guid>
		<description>thank u



thank u




:)</description>
		<content:encoded><![CDATA[<p>thank u</p>
<p>thank u</p>
<p> <img src='http://blog.joggee.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kamal</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-52</link>
		<dc:creator>kamal</dc:creator>
		<pubDate>Tue, 01 Apr 2008 16:28:32 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-52</guid>
		<description>thanks.. it worked for me [:)]</description>
		<content:encoded><![CDATA[<p>thanks.. it worked for me [:)]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumanta P</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-54</link>
		<dc:creator>Sumanta P</dc:creator>
		<pubDate>Thu, 27 Mar 2008 09:40:20 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-54</guid>
		<description>Thanks a lot Sumit Kumar, really its a cool ideas.</description>
		<content:encoded><![CDATA[<p>Thanks a lot Sumit Kumar, really its a cool ideas.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sucheta</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-53</link>
		<dc:creator>Sucheta</dc:creator>
		<pubDate>Wed, 26 Mar 2008 06:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-53</guid>
		<description>I got whatever i was searching in simple way!!!
Thanks :)</description>
		<content:encoded><![CDATA[<p>I got whatever i was searching in simple way!!!<br />
Thanks <img src='http://blog.joggee.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vijayakumarkiruba</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-55</link>
		<dc:creator>vijayakumarkiruba</dc:creator>
		<pubDate>Wed, 09 Jan 2008 10:40:56 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-55</guid>
		<description>This info was very use full.

thanks for everybody

vijay</description>
		<content:encoded><![CDATA[<p>This info was very use full.</p>
<p>thanks for everybody</p>
<p>vijay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sharad Kapil Sharma</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-50</link>
		<dc:creator>Sharad Kapil Sharma</dc:creator>
		<pubDate>Wed, 12 Dec 2007 16:36:55 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-50</guid>
		<description>Hi,

In this article there are 2 approaches described by rana and Sumit. Thanks for nice codes.

There is an another approach for retrieving hidden cell data from a GridView. I have tested it for a column which is other then a key field and it works fine.

steps...

1. sample.aspx: Consider that you have following field at 4th cell (i.e., index=3) in your gridview, which is not set as invisible at design time..

...
...

...
...

2. sample.aspx.cs:

Add RowDataBound() event for your gridview.

protected void gridview_RowDataBound(object sender, GridViewEventArgs e)
{
   ...
   ...
   e.Row.Cells[3].Visible = false;
   // same for other cells - to set invisible
   ...
   ...
}

Note:- This will set the visibility during run time. So no need to use a css file to do the same task.

3. Retrieving data: Just call the data from the cell as follows:

...
...
txtTechPersonName.Text = gridview.Cells[3].Text;
...
...

It works fine for me, hope it will work for you too.

Regards
Sharad Kapil Sharma
(to.kaps@gmail.com)


.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>In this article there are 2 approaches described by rana and Sumit. Thanks for nice codes.</p>
<p>There is an another approach for retrieving hidden cell data from a GridView. I have tested it for a column which is other then a key field and it works fine.</p>
<p>steps&#8230;</p>
<p>1. sample.aspx: Consider that you have following field at 4th cell (i.e., index=3) in your gridview, which is not set as invisible at design time..</p>
<p>&#8230;<br />
&#8230;</p>
<p>&#8230;<br />
&#8230;</p>
<p>2. sample.aspx.cs:</p>
<p>Add RowDataBound() event for your gridview.</p>
<p>protected void gridview_RowDataBound(object sender, GridViewEventArgs e)<br />
{<br />
   &#8230;<br />
   &#8230;<br />
   e.Row.Cells[3].Visible = false;<br />
   // same for other cells &#8211; to set invisible<br />
   &#8230;<br />
   &#8230;<br />
}</p>
<p>Note:- This will set the visibility during run time. So no need to use a css file to do the same task.</p>
<p>3. Retrieving data: Just call the data from the cell as follows:</p>
<p>&#8230;<br />
&#8230;<br />
txtTechPersonName.Text = gridview.Cells[3].Text;<br />
&#8230;<br />
&#8230;</p>
<p>It works fine for me, hope it will work for you too.</p>
<p>Regards<br />
Sharad Kapil Sharma<br />
(to.kaps@gmail.com)</p>
<p>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: codeproject</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-49</link>
		<dc:creator>codeproject</dc:creator>
		<pubDate>Thu, 25 Oct 2007 16:45:10 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-49</guid>
		<description>Thanks for your tip Sumit .

Its also a way to get it done.

I will try and post here.

Keep visiting me.

Rana</description>
		<content:encoded><![CDATA[<p>Thanks for your tip Sumit .</p>
<p>Its also a way to get it done.</p>
<p>I will try and post here.</p>
<p>Keep visiting me.</p>
<p>Rana</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumit Kumar Sharma</title>
		<link>http://blog.joggee.com/?p=77&#038;cpage=1#comment-48</link>
		<dc:creator>Sumit Kumar Sharma</dc:creator>
		<pubDate>Thu, 25 Oct 2007 12:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://codeproject.wordpress.com/2007/10/24/gridview-hidden-fieldhow-to-get-hidden-field-value-in-gridviewdatakeys/#comment-48</guid>
		<description>Hi All,
I have created the Grid view as following and i am able to get the value of that hidden filed. you can also use it.






















Its my grid view code.
I have just specified the css class = &quot;invisible&quot; which is as following:

.invisible
{
width:0px;
display:none:
}

Now u can use the row index and the column index for that column and use the value of it.</description>
		<content:encoded><![CDATA[<p>Hi All,<br />
I have created the Grid view as following and i am able to get the value of that hidden filed. you can also use it.</p>
<p>Its my grid view code.<br />
I have just specified the css class = &#8220;invisible&#8221; which is as following:</p>
<p>.invisible<br />
{<br />
width:0px;<br />
display:none:<br />
}</p>
<p>Now u can use the row index and the column index for that column and use the value of it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
