| | |
datagrid return value - please help
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2009
Posts: 9
Reputation:
Solved Threads: 0
will someone please help me with this. It seems simple enough but I'm very new to asp and vb. I have a datagrid and I want to know how to access the values in a specific column. The dg is bound to a sql query. The column returns integer values in sql. I want to be able to sum the column and have a button_click command send the datagrid values to 0. I only want to change the datagrid values NOT the sql values (I currently have an Update/Set sql command in vb for this but as I said I only want the Datagrid values to change). Simply put where, if anywhere are the datagrid values stored? I have the column set as a template column and the items are displayed in the datagrid as textboxes (to allow the cells in this column to be changed). can someone please help or at least tell me if this question makes any sense. thank you
1
#2 Nov 7th, 2009
Show us your code work please. You will find some useful information from this MSDN page - http://msdn.microsoft.com/en-us/library/aa479339.aspx
0
#3 Nov 9th, 2009
You can access a perticular colum in dataset by
ds.Tables[0].Rows[0]["Columnname"].ToString()
You can access a particular column of gridview in its Rowdatabound event
Hope one of it may help u
ds.Tables[0].Rows[0]["Columnname"].ToString()
You can access a particular column of gridview in its Rowdatabound event
Hope one of it may help u
•
•
•
•
will someone please help me with this. It seems simple enough but I'm very new to asp and vb. I have a datagrid and I want to know how to access the values in a specific column. The dg is bound to a sql query. The column returns integer values in sql. I want to be able to sum the column and have a button_click command send the datagrid values to 0. I only want to change the datagrid values NOT the sql values (I currently have an Update/Set sql command in vb for this but as I said I only want the Datagrid values to change). Simply put where, if anywhere are the datagrid values stored? I have the column set as a template column and the items are displayed in the datagrid as textboxes (to allow the cells in this column to be changed). can someone please help or at least tell me if this question makes any sense. thank you
•
•
Join Date: Nov 2009
Posts: 9
Reputation:
Solved Threads: 0
0
#4 Nov 9th, 2009
I am able to return all the values of the datagrid except the last column (item.cells(6).text). The vb looks like this
The difference with this column in the asp is that the values returned from the sql query are placed into editable text boxes. the asp for the datagrid is here
how am i to display the values from this template column?
ASP.NET Syntax (Toggle Plain Text)
For Each item In DataGrid1.Items Label1.Text &= "<br />" & item.Cells(0).Text & _ " " & item.Cells(1).Text & _ " " & item.Cells(2).Text & _ " " & item.Cells(3).Text & _ " " & item.Cells(4).Text & _ " " & item.Cells(5).Text & _ " " & item.Cells(6).Text Next item
The difference with this column in the asp is that the values returned from the sql query are placed into editable text boxes. the asp for the datagrid is here
ASP.NET Syntax (Toggle Plain Text)
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal"> <SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" /> <FooterStyle BackColor="#CCCC99" ForeColor="Black" /> <Columns> <asp:BoundColumn DataField="Order_Line" HeaderText="Line"></asp:BoundColumn> <asp:BoundColumn DataField="TN_CN_S_Desc" HeaderText="Description"> <ItemStyle HorizontalAlign="Left" /> </asp:BoundColumn> <asp:BoundColumn DataField="Item" HeaderText="Item"></asp:BoundColumn> <asp:BoundColumn DataField="Pack" HeaderText="Pack"></asp:BoundColumn> <asp:BoundColumn DataField="Location" HeaderText="Location"></asp:BoundColumn> <asp:BoundColumn DataField="Lot" HeaderText="Lot"></asp:BoundColumn> <asp:TemplateColumn HeaderText="# Labels"> <ItemTemplate> <asp:TextBox runat="server" Style="text-align: right" Text='<%# DataBinder.Eval(Container.DataItem,"Label_Nb") %>' Width="65"></asp:TextBox> </ItemTemplate> <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Right" /> <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Right" /> </asp:TemplateColumn> </Columns> <PagerStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" /> </asp:DataGrid>
how am i to display the values from this template column?
![]() |
Similar Threads
- Help needed... (Search thru datagrid) (Visual Basic 4 / 5 / 6)
- Event from date in DataGrid (VB.NET)
- Same Content Multiple Pages with User Control, tabControl, Gridview? (C#)
- asp.net help needed URGENT (ASP.NET)
- datagrid delete function not auto update (ASP.NET)
- Datagrid inside repeater-simple reference problem (ASP.NET)
- DataGrid: Edit mode, the index of a dropdownlist does not start at the right Value (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: how to upload an asp.net site on any particular domain and how to configure it?
- Next Thread: Editing Registry Keys
Views: 422 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 ajax alltypeofvideos appliances application asp asp.net beginner box browser button c# cac checkbox class complex connection control countryselector dataaccesslayer database datagridview datalist deployment development dgv dialog dropdownlist dynamic dynamically edit editing embeddingactivexcontrol feedback fileuploader fill findcontrol flash form gridview gudi iis image javascript languages list listbox login maps microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent problem profile project radio redirect registration relationaldatabases reportemail response.redirect richtextbox rows schoolproject search security select services sessionvariables silverlight smoobjects software sql sql-server ssl theft tracking treeview validatedate validation vb.net videos vista visualstudio vs2008 web webapplications webdevelopment webprogramming webservice wizard xsl






