how to configure a DataGrid so that only some columns are editable in Edit mode

Discussion in 'ASP .Net Datagrid Control' started by Cahoo, Aug 27, 2004.

  1. Cahoo

    Cahoo Guest

    I have been following the MSDN walkthrough "Using a DataGrid Web
    Control to Read and Write Data" in order to display an editable
    DataGrid. This has been working great - I am pleased with how simple
    it all is.

    The only thing that I haven't been able to do is select which columns
    are editable when the user clicks the Edit button in a row. My table
    has a primary key made up of 3 columns. I don't want the user to be
    able to edit these 3 columns. Is there any way for me to configure
    the data grid so that only some of the columns are editable?

    Any ideas are greatly appreciated (and thanks also for all the help
    I've gotten by searching this group so far)!
     
    Cahoo, Aug 27, 2004
    #1
    1. Advertising

  2. Right-click the DataGrid
    Click "Property Builder"
    Click "Columns"
    If the checkbox at the top is checked (something about "Automatically add
    columns at run time"), uncheck it
    In the Available Columns list, choose the ones you want
    In the Selected Columns list, click your primary key columns (one at a time)
    Click the "Read Only" check box

    This was OTTOMH, so some of the names might not be exactly right. Hope this
    helps.

    Travis Murray
    MCSD, MCT
    Artiem Consulting, Inc.
    http://www.artiem.com

    "Cahoo" <> wrote in message
    news:...
    > I have been following the MSDN walkthrough "Using a DataGrid Web
    > Control to Read and Write Data" in order to display an editable
    > DataGrid. This has been working great - I am pleased with how simple
    > it all is.
    >
    > The only thing that I haven't been able to do is select which columns
    > are editable when the user clicks the Edit button in a row. My table
    > has a primary key made up of 3 columns. I don't want the user to be
    > able to edit these 3 columns. Is there any way for me to configure
    > the data grid so that only some of the columns are editable?
    >
    > Any ideas are greatly appreciated (and thanks also for all the help
    > I've gotten by searching this group so far)!
     
    Travis Murray, Aug 28, 2004
    #2
    1. Advertising

  3. Cahoo

    Scott M. Guest

    Right click the grid and choose Property Builder, then look at the columns
    for your grid. Do you have your columns set up as Template Columns? If
    not, change each column into a Template Column via the hyperlink in the
    dialog box at the bottom. Exit from the Property Builder.

    Now, right click the grid and choose Edit Template Columns. For the
    column(s) that you DON'T want people to be able to edit, enter into the Edit
    Template of that column. Change the control that is being used for editing
    (probably a textbox or checkbox) by simply changing it's enabled property or
    locked property accordingly. You could also use a different control
    altogether, like a label to display the data.


    "Cahoo" <> wrote in message
    news:...
    >I have been following the MSDN walkthrough "Using a DataGrid Web
    > Control to Read and Write Data" in order to display an editable
    > DataGrid. This has been working great - I am pleased with how simple
    > it all is.
    >
    > The only thing that I haven't been able to do is select which columns
    > are editable when the user clicks the Edit button in a row. My table
    > has a primary key made up of 3 columns. I don't want the user to be
    > able to edit these 3 columns. Is there any way for me to configure
    > the data grid so that only some of the columns are editable?
    >
    > Any ideas are greatly appreciated (and thanks also for all the help
    > I've gotten by searching this group so far)!
     
    Scott M., Aug 28, 2004
    #3
  4. Cahoo

    -Alex Guest

    I'm a bit new at this....

    I have a simple form with a datagrid. I right click the grid and do not
    have a selection for Property Builder.

    What am I missing?

    -Alex


    "Scott M." <> wrote in message
    news:...
    > Right click the grid and choose Property Builder, then look at the columns
    > for your grid. Do you have your columns set up as Template Columns? If
    > not, change each column into a Template Column via the hyperlink in the
    > dialog box at the bottom. Exit from the Property Builder.
    >
    > Now, right click the grid and choose Edit Template Columns. For the
    > column(s) that you DON'T want people to be able to edit, enter into the

    Edit
    > Template of that column. Change the control that is being used for

    editing
    > (probably a textbox or checkbox) by simply changing it's enabled property

    or
    > locked property accordingly. You could also use a different control
    > altogether, like a label to display the data.
    >
    >
    > "Cahoo" <> wrote in message
    > news:...
    > >I have been following the MSDN walkthrough "Using a DataGrid Web
    > > Control to Read and Write Data" in order to display an editable
    > > DataGrid. This has been working great - I am pleased with how simple
    > > it all is.
    > >
    > > The only thing that I haven't been able to do is select which columns
    > > are editable when the user clicks the Edit button in a row. My table
    > > has a primary key made up of 3 columns. I don't want the user to be
    > > able to edit these 3 columns. Is there any way for me to configure
    > > the data grid so that only some of the columns are editable?
    > >
    > > Any ideas are greatly appreciated (and thanks also for all the help
    > > I've gotten by searching this group so far)!

    >
    >
     
    -Alex, Aug 30, 2004
    #4
  5. Cahoo

    Scott M. Guest

    Ah, sorry. I thought you were referring to a WebForm DataGrid, you must be
    building a Windows Applicaiton and using the Windows.Forms.DataGrid.

    I don't have the answer for you in that case. :(


    "-Alex" <> wrote in message
    news:dMMYc.4338$...
    > I'm a bit new at this....
    >
    > I have a simple form with a datagrid. I right click the grid and do not
    > have a selection for Property Builder.
    >
    > What am I missing?
    >
    > -Alex
    >
    >
    > "Scott M." <> wrote in message
    > news:...
    >> Right click the grid and choose Property Builder, then look at the
    >> columns
    >> for your grid. Do you have your columns set up as Template Columns? If
    >> not, change each column into a Template Column via the hyperlink in the
    >> dialog box at the bottom. Exit from the Property Builder.
    >>
    >> Now, right click the grid and choose Edit Template Columns. For the
    >> column(s) that you DON'T want people to be able to edit, enter into the

    > Edit
    >> Template of that column. Change the control that is being used for

    > editing
    >> (probably a textbox or checkbox) by simply changing it's enabled property

    > or
    >> locked property accordingly. You could also use a different control
    >> altogether, like a label to display the data.
    >>
    >>
    >> "Cahoo" <> wrote in message
    >> news:...
    >> >I have been following the MSDN walkthrough "Using a DataGrid Web
    >> > Control to Read and Write Data" in order to display an editable
    >> > DataGrid. This has been working great - I am pleased with how simple
    >> > it all is.
    >> >
    >> > The only thing that I haven't been able to do is select which columns
    >> > are editable when the user clicks the Edit button in a row. My table
    >> > has a primary key made up of 3 columns. I don't want the user to be
    >> > able to edit these 3 columns. Is there any way for me to configure
    >> > the data grid so that only some of the columns are editable?
    >> >
    >> > Any ideas are greatly appreciated (and thanks also for all the help
    >> > I've gotten by searching this group so far)!

    >>
    >>

    >
    >
     
    Scott M., Aug 30, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    2
    Views:
    7,659
  2. =?Utf-8?B?cG11ZA==?=

    Making ONLY 2 columns editable in a datagrid

    =?Utf-8?B?cG11ZA==?=, Jan 10, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    3,363
    =?Utf-8?B?Q2hpbm1heQ==?=
    Jan 26, 2005
  3. Vincent
    Replies:
    1
    Views:
    456
    Lucas Tam
    Aug 17, 2005
  4. mbonney
    Replies:
    0
    Views:
    1,070
    mbonney
    Sep 10, 2008
  5. Frank Kurka
    Replies:
    8
    Views:
    312
Loading...

Share This Page