reuniontitle
asked on
Gridview Checkboxfield is grayed out! (ASP.Net 2.0/Visual Web Developer 2005)
I have created a datatable, added it to a dataset, and then bound it to a gridview. The datatable has two columns: a string column named filename and a boolean column named include. I've generated the columns in my gridview. the code for it is here:
<asp:GridView ID="gvfiles" runat="server" AutoGenerateColumns="false " EmptyDataText="No Records found!">
<Columns>
<asp:TemplateField HeaderText="Filename">
<ItemTemplate>
<%#getfilename(Eval("filec olumn"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField datafield="includecolumn" HeaderText="Include in Exception?" />
</Columns>
</asp:GridView>
When the gridview is displayed the checkbox is "grayed out" and unusable. I want to be able to check the checkbox and change the dataset. Is that possible?
Here is the code I use to create the dataset:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.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( includecol umn)
Dim filelist As String() = Directory.GetFiles(basepat h)
Dim filename As String
For Each filename In filelist
Dim filetablerow As DataRow = filedatatable.newrow()
filetablerow.Item(filecolu mn) = filename
filetablerow.Item(includec olumn) = "false"
filedatatable.rows.add(fil etablerow)
Next
filedataset.Tables.Add(fil edatatable )
gvfiles.DataSource = filedataset
gvfiles.DataBind()
End Sub
Thanks in advance for your help!
<asp:GridView ID="gvfiles" runat="server" AutoGenerateColumns="false
<Columns>
<asp:TemplateField HeaderText="Filename">
<ItemTemplate>
<%#getfilename(Eval("filec
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField datafield="includecolumn" HeaderText="Include in Exception?" />
</Columns>
</asp:GridView>
When the gridview is displayed the checkbox is "grayed out" and unusable. I want to be able to check the checkbox and change the dataset. Is that possible?
Here is the code I use to create the dataset:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.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(
Dim includecolumn As New DataColumn("includecolumn"
filedatatable.columns.add(
Dim filelist As String() = Directory.GetFiles(basepat
Dim filename As String
For Each filename In filelist
Dim filetablerow As DataRow = filedatatable.newrow()
filetablerow.Item(filecolu
filetablerow.Item(includec
filedatatable.rows.add(fil
Next
filedataset.Tables.Add(fil
gvfiles.DataSource = filedataset
gvfiles.DataBind()
End Sub
Thanks in advance for your help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for the article. that helped me make my checkboxes editable.
now how can i write the changes to the dataset and then iterate through each row to check the new value?
let me know if i need to put this in a new question!