?
Solved

Gridview Checkboxfield is grayed out!  (ASP.Net 2.0/Visual Web Developer 2005)

Posted on 2007-03-28
2
Medium Priority
?
2,471 Views
Last Modified: 2013-11-07
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("filecolumn"))%>
            </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(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
        gvfiles.DataBind()

    End Sub

Thanks in advance for your help!





 
0
Comment
Question by:reuniontitle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
emailrobertwalker earned 1000 total points
ID: 18811744
Here is a great article on multiple row editing
http://www.gridviewguy.com/ArticleDetails.aspx?articleID=219
0
 

Author Comment

by:reuniontitle
ID: 18817132
emailrobertwalker,

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!

0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question