HI, Can you tell me how can i get the value of a column or columns which row i select ? 


7/30/2007 11:49:28 PM 72751 articles. 3 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 57


 write the follwing code..


here we wil get the id which we have selected ...6 is nothing but it is the 6th field we have bounded to the datagrid...




7/31/2007 4:13:58 AM

7/31/2007 4:48:45 AM

hi ,

if u are using with then write like this




7/31/2007 4:51:50 AM

Can you please be more specific regarding the type of data you are trying to get to and the event you are using.  There are different ways of accessing different things

1) If you want the primary key of the selected row you can use the DATAKEYS collection of the gridview.

2) If you just want to get to simple text data then you can use "e.Item.Cells[6].Text.Trim()"

3) If you want to access controls in the gridview cells then you have to use e.Item.FindControl("controlname") and cast it to the control type you expect and then access its value.


Dot Specialists | Send Gifts to Pakistan | Pakistan Gifts Mall
7/31/2007 5:59:43 AM
ok, excuse, yes i wnat the primary key value of the selected row, please can you tell me how can i get it ? and In Which event would i use this code ?

thanks Patrick
8/1/2007 4:24:34 AM
ok, excuse me, yes i want the primary key value of the selected row, please can you tell me how can i get it ? and In Which event would i use this code ?

thanks Patrick
8/1/2007 4:24:44 AM

 go through the following thread.. 

Thanks and Regards,
Kanakaiah etipakam(RAJA)

For God so loved the world that he gave his one and only Son (JESUS), that whoever believes in him shall not perish but have eternal life. john 3:16
8/1/2007 4:59:34 AM

Similar Artilces:

Get the column value from a DataGrid
 Hi,I have a datagrid with 6 columns. I am trying to retrieve the value of a column and pass it to a variable. I am not sure what I doing wrong here since the code I am using is not pulling any value from the column.  This is an example of what I am trying to do. Dim column_value As Stringcolumn_value = DataGrid1.Items(0).Cells.Item(4).Text                        Please correct me if I am wrong.   Thanks.    Use a GridView control instea...

Get specific datagrid value
Hello.I have datagridOrderIdFound and which is generated from sqldatasource.It returns only one row with order information. I have been trying to figure out how to retreive cell value of my colums. I have tried something like this:I have read several examples but they do not work.I use 2.0 with WD express and c#.Could someone help me here?I use my dropdownlist to change status of my order, and I need to send http: reguest with my cell value.PLEASE help. Turn the column you want to retrieve the value from into a template column and set the visibility to false, then put a label in th...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

Datagrid(.net 1.1) to GridView(.net 2.0) and using the RowUpdating event how to extract the values from the controls.
Ok  This is the settings: I use a Viewgrid with only itemtemplate colums for example. <asp:TemplateField HeaderText="Test"><ItemTemplate><asp:Label id="LBL_Test" text='<%# DataBinder.Eval(Container.DataItem, "Test1") %>' runat="server" meta:resourcekey="LBL_TestResource1"></asp:Label></font></ItemTemplate> <EditItemTemplate><asp:TextBox ID="HDN_Test" Text='<%# DataBinder.Eval(Container.DataItem, "Test1") %>' Runat="server" meta:resourcekey="HDN_TestResource1" /></EditItemTemplate></asp:TemplateField>  The ...

Getting column values that are not shown in the datagrid
Hi,I've had this litte problem several times and couldn't really solve it:void BindGrid(){   ...   string sql = "select ID, Name, AnotherID from ....";   ...}The columns "ID" and "Name" are shown by the DataGrid, the column "AnotherID" is not shown.void OnItem(object Sender, DataGridCommandEventArgs e){   now, here I want to access "AnotherID" for the selected row. someting like "((TextBox)  e.Item.Cells[1].Controls[1]).Text ));" will not work, of course,   since "AnotherID" is not shown in the DataGrid. &nb...

how to get the value out of the HyperLink column in the datagrid
I need to get the text which is displayed in the hyperlink column. I tried many ways but always it returns empty "". This is little bit of my C# code: foreach(DataGridItem dgi in myDataGrid.Items)             {                 CheckBox myCheckBox = (CheckBox)dgi.Cells[3].Controls[1];                 HyperLinkColumn hyper = (HyperLinkColumn) myDataGrid.Columns[1];          ...

how to get specific cell value from datagrid
hi every one i have two datagrid on a form. on load event of form i bind the grid with the data coming from xml file like belowDataSet dsRead = new DataSet(); dsRead.ReadXml("C:\\Documents and Settings\\atifi\\My Documents\\My Received Files\\RepairDB1.xml");DataView customersDV = dsRead.Tables[1].DefaultView; ;customersDV.RowFilter = "id like '%0%'"; DataGrid1.DataSource = customersDV; DataGrid1.DataBind();  DataView customersDV1 = dsRead.Tables[1].DefaultView; ;customersDV1.RowFilter = "id not like '%0%'"; DataGrid2.DataSource = c...

How can I get the value of a column in a datagrid?
Hello. I have a datagird with textboxes on a column item template, I also have 2 other columns that are hidden and I want to retrieve his value. But I havent found how to do it. Thanks very much in advance This is the code that loops through all rows. find the textboxes controls Private Sub btnguardarplandesarrollo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnguardarplandesarrollo.Click Page.Validate() If Page.IsValid Then Dim cont As Int32 = 0 Dim di As DataGridItem For Each di In dgplandesarrollo.Items Dim responsabili...

How to get values from 3 columns of my datagrid
Hi, I have a dg that when the page loads it opens in edit mode, all rows. I am doing this by using template columns in my dg and by placing editable items( text box, check box list, etc) in the item template area so when the datagrid loads it automatically have this controls redy for the user's input, some other columns are actually binding from a stored proc. The problem is, I don't know how to retrieve the values that exist in those controls.Sample code: For i = 0 To dgProductItems.Items.Count - 1 objPDF = CType(dgProductItems.Items(1).Cells(6).Controls(0), RadioButtonList) If objPDF.Se...

How to get a datagrid column value into a variable?
Hi all, I have a datagrid which contains a column [Batch_Num] in the 7th column. In dgAppStatus_Delete(), I want to delete a row based on the employID and Batch_Num, where employID is the DataKeyField in the datagrid. However, how can I get the value of Batch_Num???? Please help. Thanks. -------------------------------- Sub BindData() Dim strSql As New SqlCommand Dim dtrDataGrid As SqlDataReader Dim dataAdapter As New SqlDataAdapter Dim dataSet As New DataSet Dim Source As DataView Try 'Ini...

Getting the value of a certain column in the datagrid
Its quite simple what I'm trying to do but its never that simple when u don't know how. I just need to get the value of a certain column. noteID = (int) C1WebGrid1.DataKeys[e.Item.ItemIndex]; This lets me get the column id which i use to tell the db that this note is to status is to be set as read, this then moves the row into another grid. Problem is I need to run the read/unread through an if statement so i can toggle the row has read/unread. If I know that it been returned as unread then I toggle it to read and vice versa. I just need to that column value from the grid. ...

Getting column value from a gridview control
I have a grid view control and has one datakey and other columns. In my grid view I have an Edit Control and a Delete Control. 1) When I press Edit control, I am getting datakey value as expected. But I am not getting other column name i.e. pdf_filename 2) when I press Delete control, I should get the datakey value. But I am not getting I am using c#  Please help me Hi vmk, Could you be a littlemore elaborate? like how have you bound your grid? 1.Columns autogenerated 2.Using TemplateFields 3.Using BoundFields.Regards,NaveenPlease remember to click Mark as Answer on the pos...

Getting the value out of the Template Column in Datagrid
)'> How can I get the Value of the BatchID. )'><ItemTemplate>                                                                                 <%# DataBinder.Eval(Container.DataItem, "BatchID") %>              ...

Getting value from a column in a datagrid for record
I have an ASP.NET page with a datagrid on it.  It has an Edit button column on it which I am changing what happens when you click on it.  Originally it opens up editing boxes in the datagrid, I am moving the editing function to an external form.  I have modified the Edit command and am able to get the Index number of the record I clicked on with  e.Item.ItemIndex or DataGrid1.SelectedIndex but the problem is that I need the ID of the record, which is located in a hidden column  (Column 1).  What would be the best means to be able to extract the ID from t...


Specific - Wikipedia, the free encyclopedia
Specific Pathogen Free , of a laboratory animal guaranteed free of particular (i.e., specific and named) pathogens "Specific" generally means ...

Specific activity - Wikipedia, the free encyclopedia
... SI quantity related to the phenomenon of natural and artificial radioactivity. The SI unit of "activity" is becquerel, Bq, while that of "specific ...

Facebook Displays Percent Of Users Who Like Pages Who Have Seen Specific Posts
Facebook continues to quietly add and tweak features behind-the-scenes, without fanfare or announcements, and the latest example is the addition ...

Facebook Tests Interest-Specific News Feeds on Mobile - Digital - Advertising Age
... have sections, and now so does Facebook's news feed, at least for some people. The social network has been experimenting with category-specific ...

Mad Catz launching Samsung-specific game controllers
... their game controllers to Samsung Mobile. Mad Catz is revealing at CES 2016 that they are developing controllers and game pads that are specifically ...

Navy Football to Feature Position-Specific 'Navy Fleet' Helmets for Army Game - Bleacher Report
For the first time in NCAA history, a college football team will have its players wearing different helmets during the game based on the position ...

The FTC has finally given some specific guidance on what native ads are meant to look like
... on a journalism website. The FTC has been exploring how to effectively police native advertising since 2013. On Tuesday it released specific ...

Nashua Public Schools Closed Following ‘Specific’ Threat Of Violence
All public schools in Nashua, NH, will be closed Monday after school officials received a detailed threat of violence involving the city's two ...

Obama: No specific, credible threat indicating plot against U.S.
After a meeting with his national security team, the president tells Americans to "go about their usual Thanksgiving weekend activities"

Obama: 'No specific, credible' threat to U.S.
... threat" against the U.S. from ISIS. Breaking News CNN Toggle Search Search 2016 Washington Nation World Our Team Obama: 'No specific, ...

Resources last updated: 1/7/2016 11:16:38 PM