-
How do i edit a dataset from gridview and then iterate through the updated dataset
I've got an editable gridview bound to a dataset. I would like to place a button below the gridview. When it is clicked, I want it to submit the data in the gridview back into the bound dataset, and then i want to iterate through the records in the dataset. Any code samples/documentation/references would be appreciated!
The code for the gridview is here:
<asp:GridView ID="gvfiles" runat="server" AutoGenerateColumns="false" EmptyDataText="No Records found!">
<Columns>
<asp:TemplateField HeaderText="Filename">
<ItemTemplate>
<%#getfilename(Eval("filecolumn"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Include?">
<ItemTemplate>
<asp:CheckBox id="cbinclude" runat="server" Visible='<%# isineditmode %>' checked='<%# eval("includecolumn") %>'></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
The code used to build my dataset is below(it's in the page_load):
Dim basepath As String = Request.QueryString("path")
Dim filedataset As New dataset()
Dim filedatatable = New DataTable("filetable")
Dim filecolumn As New DataColumn("filecolumn")
filedatatable.columns.add(filecolumn)
Dim includecolumn As New DataColumn("includecolumn")
filedatatable.columns.add(includecolumn)
Dim filelist As String() = Directory.GetFiles(basepath)
Dim filename As String
For Each filename In filelist
Dim filetablerow As DataRow = filedatatable.newrow()
filetablerow.Item(filecolumn) = filename
filetablerow.Item(includecolumn) = "false"
filedatatable.rows.add(filetablerow)
Next
filedataset.Tables.Add(filedatatable)
gvfiles.DataSource = filedataset
iseditmode = True
gvfiles.DataBind()
Thanks in advance for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks