help with datagrid

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2009
Posts: 9
Reputation: smd5049 is an unknown quantity at this point 
Solved Threads: 0
smd5049 smd5049 is offline Offline
Newbie Poster

help with datagrid

 
0
  #1
20 Days Ago
I have a datagrid bound to a sql proc. I have made the last column in the datagrid into text boxes so the items are editable. how do i return the values from these cells? Basically I want to be able to sum the entire column, as well as set the values in each item of the column to 0 upon a button_click. I'm very new to vb.net and if I'm not explaining this correctly please let me know.

the datagrid is built through this funtion:
  1. Dim strConnString As String
  2. Dim strSQLText As String
  3. strConnString = ConfigurationManager.ConnectionStrings("SDWConnectionString").ToString
  4. strSQLText = "SELECT TN_CN_S_Desc, Item, Pack, Location, Lot, Label_Nb from sdw.sdw_user.SAR_DTD_840_copy where Pick_Num = '" & Picklist & "'"
  5.  
  6. Dim SqlCOnnection As New SqlConnection(strConnString)
  7. SqlCOnnection.Open()
  8.  
  9. Dim sqlCmd As New SqlCommand(strSQLText, SqlCOnnection)
  10.  
  11. Dim adapter As New SqlClient.SqlDataAdapter(strSQLText, SqlCOnnection)
  12.  
  13. Dim ds As New DataSet
  14.  
  15. adapter.Fill(ds, "sdw.sdw_user.SAR_DTD_840_copy")
  16. Dim dataTable = ds.Tables("sdw.sdw_user.SAR_DTD_840_copy")
  17.  
  18. Me.DataGrid1.DataSource = dataTable
  19. Me.DataGrid1.AutoGenerateColumns = False
  20. Me.DataGrid1.DataBind()


the html for the column that I made editable and want to sum/set to zero looks like this:
  1. <asp:TemplateColumn HeaderText="# Labels">
  2. <EditItemTemplate>
  3. <asp:TextBox ID="txtlbls" runat="server" Style="text-align: right" Text='<%# DataBinder.Eval(Container.DataItem,"Label_Nb") %>'
  4. Width="65"></asp:TextBox>
  5. </EditItemTemplate>
  6. <ItemTemplate>
  7. <asp:TextBox ID="txtlbls" runat="server" Style="text-align: right" Text='<%# DataBinder.Eval(Container.DataItem,"Label_Nb") %>'
  8. Width="65"></asp:TextBox>
  9. </ItemTemplate>
  10. </asp:TemplateColumn>
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC