944,048 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 413
  • ASP.NET RSS
Nov 5th, 2009
0

help with datagrid

Expand Post »
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:
ASP.NET Syntax (Toggle Plain Text)
  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:
ASP.NET Syntax (Toggle Plain Text)
  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>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
smd5049 is offline Offline
10 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Retrieve EditItemTemplate controls of GridView at code-behind file
Next Thread in ASP.NET Forum Timeline: Membership, Profiles and Security





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC