whats wrong with my code?http://forums.asp.net/t/1798751.aspx/1?whats+wrong+with+my+code+Tue, 01 May 2012 08:49:44 -040017987514959452http://forums.asp.net/p/1798751/4959452.aspx/1?whats+wrong+with+my+code+whats wrong with my code? <p>I dont get any cell value in the code below for this statement :&nbsp;<strong>gvDynamicControl.Rows[1].Cells[6].ToString()</strong></p> <p></p> <p>I wont to compare the gridview cell value and return the rowindex</p> <p></p> <p>for (int rowIndex = 0; rowIndex &lt; gv.Rows.Count; rowIndex&#43;&#43;)<br> {<br> for (int columnIndex = 0; columnIndex &lt; gv.Columns.Count; columnIndex&#43;&#43;)<br> {</p> <p><br> if <strong>(gvDynamicControl.Rows[1].Cells[6].ToString() ==&quot;Test&quot;)</strong><br> Session[&quot;rowIndex&quot;] = rowIndex;</p> <p><br> <br> <br> }</p> <p>}</p> 2012-05-01T08:25:51-04:004959458http://forums.asp.net/p/1798751/4959458.aspx/1?Re+whats+wrong+with+my+code+Re: whats wrong with my code? <p>No idea what your code does, but shouldn't it look like:</p> <p>if(gvDynamicControl.Rows[rowIndex].Cells[columnIndex].ToString() == &quot;Test)<br> ...&nbsp;</p> 2012-05-01T08:31:18-04:004959461http://forums.asp.net/p/1798751/4959461.aspx/1?Re+whats+wrong+with+my+code+Re: whats wrong with my code? <p>I want to compare the cell/column value of a gridview and return the rowindex...how can i achieve that ?</p> 2012-05-01T08:34:13-04:004959466http://forums.asp.net/p/1798751/4959466.aspx/1?Re+whats+wrong+with+my+code+Re: whats wrong with my code? <p>Hi,</p> <p></p> <p>Here is simple code for get data from datagrid and grid view</p> <pre class="prettyprint">protected void btnGetData_Click(object sender, EventArgs e) { string subjectName = string.Empty; int Subjectid = 0; //get data from datagrid subjectName = grdgrid.Items[0].Cells[0].Text; int.TryParse(grdgrid.Items[0].Cells[1].Text,out Subjectid); //get data from gridview subjectName=grdview.Rows[0].Cells[0].Text; int.TryParse(grdview.Rows[0].Cells[1].Text, out Subjectid); }</pre> <p>now can you tell me in which event you are writing code means like grid view itemcommand,prerender etc</p> <p><br> <br> </p> 2012-05-01T08:44:15-04:004959472http://forums.asp.net/p/1798751/4959472.aspx/1?Re+whats+wrong+with+my+code+Re: whats wrong with my code? <p>I am rendering my grid on pre-render... i am writing this code on selected index change event of my radiobutton within the gridview...after the grid has been renedered if I select &quot;Yes&quot; for the radiobutton I want to show the child row of the gridview and if we select &quot;No&quot; I want to hide the gridview row... I have the value of the child control column... Now i want to loop through the gridview rows and columns and match that value and return the rowIndex so i can hide the entire row of gridview...&nbsp;</p> 2012-05-01T08:47:55-04:004959478http://forums.asp.net/p/1798751/4959478.aspx/1?Re+whats+wrong+with+my+code+Re: whats wrong with my code? <p><a href="http://forums.asp.net/t/1477232.aspx">http://forums.asp.net/t/1477232.aspx</a></p> 2012-05-01T08:49:44-04:00