Set readonly property on cell level in a datagridview

Discussion in 'ASP .Net Building Controls' started by Patrik, Feb 15, 2007.

  1. Patrik

    Patrik Guest

    Hi,

    I have a datagridview column that will contain both editable and
    non-editable values. I have set the columns readonly property to true. I
    then use the AddRows event to check the value of an hidden column and if
    that is false i set a specific cells readonly property in the column to
    false.

    My problems is that this do not open a specific cell for editing but seems
    to open all cells in the column. Is it not possible to have some cells in a
    column to override the columns readonly property?
    Patrik, Feb 15, 2007
    #1
    1. Advertising

  2. Hello Patrik,

    As for the "DataGridView" control, do you mean the DataGrid or GridView
    control? I'd like to confirm that you're using either of the two ASP.NET
    template databound controls.

    According to your description, you want to make a certain column(multiple
    rows) in the GridView control have different editable status for each row
    of that column, correct? If so, here are some of my understanding and some
    questions which need your confirm:

    ** For the Readonly property of GridViews' columns, when you set it, it
    will be applied to all the rows of that column, therefore, this property
    can not be used to adjust individual cell(of a certain column)'s visibility
    or edit mode.

    ** Since you want some rows of the column to be editable, how do you add
    the edit UI/tempalte? Do you define two templates(ItemTemplate and
    EditTemplate) or simply define only one template(ItemTemplate) and put
    different control according to whether that row is editable?

    ** Is the "AddRows" event the "RowCreated" event of GridView? If so
    what's your current code logic in it?

    I would be helpful if you can provide us some code fragment to demonstrate
    your current implement so that we can perform research on this.

    Please feel free to post here if there is anything I missed.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Feb 15, 2007
    #2
    1. Advertising

  3. Patrik

    Patrik Guest

    I am sorry, I just realized that I have posted this in the wrong newsgroup.
    I am working with the windows forms datagridview using C#.

    /Patrik

    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hello Patrik,
    >
    > As for the "DataGridView" control, do you mean the DataGrid or GridView
    > control? I'd like to confirm that you're using either of the two ASP.NET
    > template databound controls.
    >
    > According to your description, you want to make a certain column(multiple
    > rows) in the GridView control have different editable status for each row
    > of that column, correct? If so, here are some of my understanding and
    > some
    > questions which need your confirm:
    >
    > ** For the Readonly property of GridViews' columns, when you set it, it
    > will be applied to all the rows of that column, therefore, this property
    > can not be used to adjust individual cell(of a certain column)'s
    > visibility
    > or edit mode.
    >
    > ** Since you want some rows of the column to be editable, how do you add
    > the edit UI/tempalte? Do you define two templates(ItemTemplate and
    > EditTemplate) or simply define only one template(ItemTemplate) and put
    > different control according to whether that row is editable?
    >
    > ** Is the "AddRows" event the "RowCreated" event of GridView? If so
    > what's your current code logic in it?
    >
    > I would be helpful if you can provide us some code fragment to demonstrate
    > your current implement so that we can perform research on this.
    >
    > Please feel free to post here if there is anything I missed.
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > ==================================================
    >
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    >
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    >
    Patrik, Feb 15, 2007
    #3
  4. Thanks for your reply Patrik,

    If so, you can post the question in the following newsgroups which would be
    helpful for you to get the quick and proper response:

    microsoft.public.dotnet.framework.windowsforms
    microsoft.public.dotnet.framework.windowsforms.controls

    Also, if you meet any ASP.NET issues, welcome to post here :)

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Feb 16, 2007
    #4
    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. John Smith
    Replies:
    5
    Views:
    7,015
    Bob Barrows [MVP]
    Jun 6, 2006
  2. pabbu
    Replies:
    8
    Views:
    710
    Marc Boyer
    Nov 7, 2005
  3. Greg Smith

    Getting the value in a cell in a DataGridView

    Greg Smith, Jul 5, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    133
    Winista
    Jul 27, 2006
  4. Jonathan Hyatt
    Replies:
    1
    Views:
    1,867
    Jonathan Hyatt
    Jun 8, 2004
  5. vinda

    Set Gridview Edit cell to Readonly Bug

    vinda, Jun 13, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    205
    vinda
    Jun 13, 2006
Loading...

Share This Page