Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hii friends..i have written following code on my .aspx page...now i want value/id for this boundfield on my .cs code..plz help me..Thanks..

C#
<asp:BoundField HeaderStyle-CssClass="grdheadermstertime"  DataField="fromdate" ReadOnly="true" HeaderText="From Date"  >
                                            <HeaderStyle CssClass="grdheadermstertime" />
                                            <ItemStyle CssClass="griditemstletime" />
                                        </asp:BoundField 
Posted

Simple you write this code any place where you want get your desired value...
Code:
C#
string value = dtgDetail.Rows[RowIndex].Cells[BoundFieldIndex].Text;
/* Here 
   dtgDetail = your GridView
   RowIndex = your desired row index 
   BoundFieldIndex = your desired field index. */
 
Share this answer
 
v2
Comments
remowo 18-Jul-17 4:05am    
Be aware for this solution acquires visible ONLY cell text
use OnRowDataBound event to get the value for fromdate-field

see here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900