How can I get other column value of DataSource in ItemDataBound event?

Hi all

In ItemDataBound event, How can I get other column value of DataSource?
for example ,I have 3 column,customer_id,customer_name,customer_tel
customer_id,customer_name has display on DataGrid.
Now I want to get customer_tel in ItemDatabound event.
How do I?
Thanks a lot.
Clare
0
clare
8/16/2004 2:07:12 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
887 Views

Similar Articles

[PageSpeed] 42

There is a DataItem property of the e.Item that ruturns items datasource. All you need to do is to cast it to an appropriate type. If you binding your grid to DataTable or DataView, it is DataRowView


Dim dtr as DataRowView = ctype(e.Item.DataItem,DataRowView)

Bug [MCSD]
0
Bug_Bugger
8/16/2004 8:51:52 AM
Reply:

Similar Artilces:

LITERAL control containing html SELECT control
on a web page written in VB.NET , I have a literal control created. It's contents is : Literal1.Text = " <select name=""addselect"" id =""addselect"" style=""width=100%"" size=""2"" maxlength=""27"" runat=server " & _ " onclick=""__doPostBack(" & _ "'addselect','')"" " & _ " language= ""javascript""> " & _ " <optgroup label="&quo...

How can I dynamically access control inside DataList ItemDataBound event when SeparatorTemplate is used for DataList control?
Hello, Usually I can dynamically access control (Label in this case) inside DataList ItemDataBound event using this code: Dim Label1 As Label = e.Item.FindControl("Label1")Label1.Text = "sample text" But when custom SeparatorTemplate is used for DataList control, then this code no longer works and produces this error: Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code...

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: http://forums.asp.net/t/1069245.aspx 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....

Get a Clicked Column Index Integer value for a GridView column using the Sorting Event Handler
I am creating a GridView nested within a UpdatePanel and I got the sorting, paging all down to a sciene using the GridView events handlers. Now, I stumbled to a minor problem that I can't seem to figure out how to go about it. When sorting, I would like the heading color of the clicked sorted column to change (using CSS). I can't seem to dynamically pass the value of the clicked column index to the method. I am using the following reference to change the color of the column but I cannot seem to retreive the value of the clicked index in integer value: GridView1.Columns(trying to...

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 ...

How can I get data value from datasource
I Have extracted data from an access database created a datagrid which works great. In the data grid I am only using part of the columns extracted from the data base. The dataTarps_Commands sub is executed when a link button is clicked in the datagrid. I am able to retive item data that is displayed using bound columns in the data grid but I have not been able get cell information for columns not displayed or displayed using template columns. Is there a way to get information from the data source in a function. Ideally I would like to address these cells using the header name and curren...

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...

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 can I get values from a CrossTab Column ??
Tnx If your crosstab in static mode, just refer directly by the names of columns (you'll see it on DW painter). If your crosstab in dynamic mode (that is your columns build dynamicly in run time) you have to write some code. The main thing here is that PB assigns itself names to generated columns. Just find out what is "base" name for your column in DW painter (in my case it's 'summa') By this name you can refer to the column, but to the first column only. To refere to the second, third ... and so on columns just add '_1' for second, '_2...

how can i get the values in checklist control?
i have a checkboxlist control with values inside like five values. i want to check multiple values and band it to a label. pls how is it possible? string str = "";foreach(ListItem li in CheckBox1.Items){    if (li.Selected)        str += li.Value + "<br />";}Label1.Text = str;You can use www.codechanger.com to convert to VB is required.  Regards Mike [MVP - ASP/ASP.NET]My site...

how can get the group column value?
My dw have group and group total columns, I can use getitem to obtain the first group's group total value, but how can I get the other group's group total value? I use dw_report.getitemnumber(?, "group_total) no matter what value of ?, all return the first group total value!! pls help!!! ...

How can i get the default-value of a column?
I' m using this statement with VB 6.0: select column_name, table_name, "default" from syscolumn, systable join syscolumn on systable.table_id = syscolumn.table_id where table_name='TRegieBuchungen' => it works fine with ISQL. But when i refer to the result-set of VB, i always get an Error "No update tables are specified". Any ideas? thanks! >select column_name, table_name, "default" from syscolumn, systable join >syscolumn on systable.table_id = syscolumn.table_id where >table_name='TRegieBuchungen' >...

Getting the value of a control in gridview_rowcommand event
I have this gridview control with a linkbutton control. the index of the / datakey of the records/data bind to the gridview is a string. I assign each index to the commandargument of the control and eventname as "play", I also have another control i assign a value called "hiddenfield", all in the templatecolumn, all I want to achieve is that whenever I click on the button from the gridview_rowcommand event, I want to be able to get the value of the control - hiddenfield at anytime i clicked the biutton.This is my html code <asp:GridView ID="GVVideos" AutoGene...

How can i get the default-value of a column
I' m using this statement with VB 6.0: select column_name, table_name, "default" from syscolumn, systable join syscolumn on systable.table_id = syscolumn.table_id where table_name='TRegieBuchungen' => it works fine with ISQL. But when i refer to the result-set of VB, i always get an Error "No update tables are specified". Any ideas? thanks! Christian c.pauzenberger@telecom.at ...

Web resources about - How can I get other column value of DataSource in ItemDataBound event? - asp.net.presentation-controls

Resources last updated: 1/5/2016 3:39:30 AM