EditItemTemplate question

Discussion in 'ASP .Net' started by =?Utf-8?B?Tkg=?=, Aug 11, 2005.

  1. How can I only display the textbox I have in an EditItemTemplate based on the
    value in another cell in the row?

    i.e I only want users to edit one of the cells based on the value in another
    cell....

    Should I do this in the ItemDataBound event of the datagrid...something
    like...
    If e.Item.Cells(8).Text = "2" Then
    dont allow the textbox defined in the EditItemTemplate to be visible
    what is the code for this?
    End If

    Thanks for your help
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #1
    1. Advertising

  2. e.Item.Controls.FindControl("TextBox's Id").Visible = false;



    "NH" <> wrote in message
    news:...
    > How can I only display the textbox I have in an EditItemTemplate based on
    > the
    > value in another cell in the row?
    >
    > i.e I only want users to edit one of the cells based on the value in
    > another
    > cell....
    >
    > Should I do this in the ItemDataBound event of the datagrid...something
    > like...
    > If e.Item.Cells(8).Text = "2" Then
    > dont allow the textbox defined in the EditItemTemplate to be
    > visible
    > what is the code for this?
    > End If
    >
    > Thanks for your help
     
    Grant Merwitz, Aug 11, 2005
    #2
    1. Advertising

  3. thanks for the reply.

    I get a "Object reference not set to an instance of an object" error with
    the line
    CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False

    Should the EditItemTemplate control be referenceable in the ItemDataBound
    datagrid event? Its as if it doesnt know about the control?

    "Grant Merwitz" wrote:

    > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    >
    >
    >
    > "NH" <> wrote in message
    > news:...
    > > How can I only display the textbox I have in an EditItemTemplate based on
    > > the
    > > value in another cell in the row?
    > >
    > > i.e I only want users to edit one of the cells based on the value in
    > > another
    > > cell....
    > >
    > > Should I do this in the ItemDataBound event of the datagrid...something
    > > like...
    > > If e.Item.Cells(8).Text = "2" Then
    > > dont allow the textbox defined in the EditItemTemplate to be
    > > visible
    > > what is the code for this?
    > > End If
    > >
    > > Thanks for your help

    >
    >
    >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #3
  4. the line its failing on is
    CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False

    Its says "Input string was not in a correct format. "

    "NH" wrote:

    > thanks for the reply.
    >
    > I get a "Object reference not set to an instance of an object" error with
    > the line
    > CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False
    >
    > Should the EditItemTemplate control be referenceable in the ItemDataBound
    > datagrid event? Its as if it doesnt know about the control?
    >
    > "Grant Merwitz" wrote:
    >
    > > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >
    > >
    > >
    > > "NH" <> wrote in message
    > > news:...
    > > > How can I only display the textbox I have in an EditItemTemplate based on
    > > > the
    > > > value in another cell in the row?
    > > >
    > > > i.e I only want users to edit one of the cells based on the value in
    > > > another
    > > > cell....
    > > >
    > > > Should I do this in the ItemDataBound event of the datagrid...something
    > > > like...
    > > > If e.Item.Cells(8).Text = "2" Then
    > > > dont allow the textbox defined in the EditItemTemplate to be
    > > > visible
    > > > what is the code for this?
    > > > End If
    > > >
    > > > Thanks for your help

    > >
    > >
    > >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #4
  5. i think it should be

    CType(e.Item.Controls.FindControl("txtDaysWriteOffed"), TextBox).Enabled =
    False

    Adding the 'FindControl' in there

    "NH" <> wrote in message
    news:D...
    > the line its failing on is
    > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    >
    > Its says "Input string was not in a correct format. "
    >
    > "NH" wrote:
    >
    >> thanks for the reply.
    >>
    >> I get a "Object reference not set to an instance of an object" error with
    >> the line
    >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False
    >>
    >> Should the EditItemTemplate control be referenceable in the ItemDataBound
    >> datagrid event? Its as if it doesnt know about the control?
    >>
    >> "Grant Merwitz" wrote:
    >>
    >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    >> >
    >> >
    >> >
    >> > "NH" <> wrote in message
    >> > news:...
    >> > > How can I only display the textbox I have in an EditItemTemplate
    >> > > based on
    >> > > the
    >> > > value in another cell in the row?
    >> > >
    >> > > i.e I only want users to edit one of the cells based on the value in
    >> > > another
    >> > > cell....
    >> > >
    >> > > Should I do this in the ItemDataBound event of the
    >> > > datagrid...something
    >> > > like...
    >> > > If e.Item.Cells(8).Text = "2" Then
    >> > > dont allow the textbox defined in the EditItemTemplate to be
    >> > > visible
    >> > > what is the code for this?
    >> > > End If
    >> > >
    >> > > Thanks for your help
    >> >
    >> >
    >> >
     
    Grant Merwitz, Aug 11, 2005
    #5
  6. Yes I tried that but it says "FindControl" is not a member of
    System.Web.UI.ControlCollection"

    thanks

    "Grant Merwitz" wrote:

    > i think it should be
    >
    > CType(e.Item.Controls.FindControl("txtDaysWriteOffed"), TextBox).Enabled =
    > False
    >
    > Adding the 'FindControl' in there
    >
    > "NH" <> wrote in message
    > news:D...
    > > the line its failing on is
    > > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    > >
    > > Its says "Input string was not in a correct format. "
    > >
    > > "NH" wrote:
    > >
    > >> thanks for the reply.
    > >>
    > >> I get a "Object reference not set to an instance of an object" error with
    > >> the line
    > >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False
    > >>
    > >> Should the EditItemTemplate control be referenceable in the ItemDataBound
    > >> datagrid event? Its as if it doesnt know about the control?
    > >>
    > >> "Grant Merwitz" wrote:
    > >>
    > >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >> >
    > >> >
    > >> >
    > >> > "NH" <> wrote in message
    > >> > news:...
    > >> > > How can I only display the textbox I have in an EditItemTemplate
    > >> > > based on
    > >> > > the
    > >> > > value in another cell in the row?
    > >> > >
    > >> > > i.e I only want users to edit one of the cells based on the value in
    > >> > > another
    > >> > > cell....
    > >> > >
    > >> > > Should I do this in the ItemDataBound event of the
    > >> > > datagrid...something
    > >> > > like...
    > >> > > If e.Item.Cells(8).Text = "2" Then
    > >> > > dont allow the textbox defined in the EditItemTemplate to be
    > >> > > visible
    > >> > > what is the code for this?
    > >> > > End If
    > >> > >
    > >> > > Thanks for your help
    > >> >
    > >> >
    > >> >

    >
    >
    >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #6
  7. sorry, drop out the control bit

    e.Item.FindControl("MyControl")


    "NH" <> wrote in message
    news:...
    > Yes I tried that but it says "FindControl" is not a member of
    > System.Web.UI.ControlCollection"
    >
    > thanks
    >
    > "Grant Merwitz" wrote:
    >
    >> i think it should be
    >>
    >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"), TextBox).Enabled
    >> =
    >> False
    >>
    >> Adding the 'FindControl' in there
    >>
    >> "NH" <> wrote in message
    >> news:D...
    >> > the line its failing on is
    >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    >> >
    >> > Its says "Input string was not in a correct format. "
    >> >
    >> > "NH" wrote:
    >> >
    >> >> thanks for the reply.
    >> >>
    >> >> I get a "Object reference not set to an instance of an object" error
    >> >> with
    >> >> the line
    >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible =
    >> >> False
    >> >>
    >> >> Should the EditItemTemplate control be referenceable in the
    >> >> ItemDataBound
    >> >> datagrid event? Its as if it doesnt know about the control?
    >> >>
    >> >> "Grant Merwitz" wrote:
    >> >>
    >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    >> >> >
    >> >> >
    >> >> >
    >> >> > "NH" <> wrote in message
    >> >> > news:...
    >> >> > > How can I only display the textbox I have in an EditItemTemplate
    >> >> > > based on
    >> >> > > the
    >> >> > > value in another cell in the row?
    >> >> > >
    >> >> > > i.e I only want users to edit one of the cells based on the value
    >> >> > > in
    >> >> > > another
    >> >> > > cell....
    >> >> > >
    >> >> > > Should I do this in the ItemDataBound event of the
    >> >> > > datagrid...something
    >> >> > > like...
    >> >> > > If e.Item.Cells(8).Text = "2" Then
    >> >> > > dont allow the textbox defined in the EditItemTemplate to
    >> >> > > be
    >> >> > > visible
    >> >> > > what is the code for this?
    >> >> > > End If
    >> >> > >
    >> >> > > Thanks for your help
    >> >> >
    >> >> >
    >> >> >

    >>
    >>
    >>
     
    Grant Merwitz, Aug 11, 2005
    #7
  8. Yeah this is something I tried also, get an ""Object reference not set to an
    instance of an object" error.

    It looks like the EditItemTemplate control is not referenceabnle in the
    ItemDataBound event?

    "Grant Merwitz" wrote:

    > sorry, drop out the control bit
    >
    > e.Item.FindControl("MyControl")
    >
    >
    > "NH" <> wrote in message
    > news:...
    > > Yes I tried that but it says "FindControl" is not a member of
    > > System.Web.UI.ControlCollection"
    > >
    > > thanks
    > >
    > > "Grant Merwitz" wrote:
    > >
    > >> i think it should be
    > >>
    > >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"), TextBox).Enabled
    > >> =
    > >> False
    > >>
    > >> Adding the 'FindControl' in there
    > >>
    > >> "NH" <> wrote in message
    > >> news:D...
    > >> > the line its failing on is
    > >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    > >> >
    > >> > Its says "Input string was not in a correct format. "
    > >> >
    > >> > "NH" wrote:
    > >> >
    > >> >> thanks for the reply.
    > >> >>
    > >> >> I get a "Object reference not set to an instance of an object" error
    > >> >> with
    > >> >> the line
    > >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible =
    > >> >> False
    > >> >>
    > >> >> Should the EditItemTemplate control be referenceable in the
    > >> >> ItemDataBound
    > >> >> datagrid event? Its as if it doesnt know about the control?
    > >> >>
    > >> >> "Grant Merwitz" wrote:
    > >> >>
    > >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >> >> >
    > >> >> >
    > >> >> >
    > >> >> > "NH" <> wrote in message
    > >> >> > news:...
    > >> >> > > How can I only display the textbox I have in an EditItemTemplate
    > >> >> > > based on
    > >> >> > > the
    > >> >> > > value in another cell in the row?
    > >> >> > >
    > >> >> > > i.e I only want users to edit one of the cells based on the value
    > >> >> > > in
    > >> >> > > another
    > >> >> > > cell....
    > >> >> > >
    > >> >> > > Should I do this in the ItemDataBound event of the
    > >> >> > > datagrid...something
    > >> >> > > like...
    > >> >> > > If e.Item.Cells(8).Text = "2" Then
    > >> >> > > dont allow the textbox defined in the EditItemTemplate to
    > >> >> > > be
    > >> >> > > visible
    > >> >> > > what is the code for this?
    > >> >> > > End If
    > >> >> > >
    > >> >> > > Thanks for your help
    > >> >> >
    > >> >> >
    > >> >> >
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #8
  9. How about if you try that code in the EditCommand

    private void DataGrid1_EditCommand(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)

    {

    e.Item.FindControl("");

    }



    not sure the VB code for that, but accessed through the DataGrid property
    'EditCommand'


    "NH" <> wrote in message
    news:...
    > Yeah this is something I tried also, get an ""Object reference not set to
    > an
    > instance of an object" error.
    >
    > It looks like the EditItemTemplate control is not referenceabnle in the
    > ItemDataBound event?
    >
    > "Grant Merwitz" wrote:
    >
    >> sorry, drop out the control bit
    >>
    >> e.Item.FindControl("MyControl")
    >>
    >>
    >> "NH" <> wrote in message
    >> news:...
    >> > Yes I tried that but it says "FindControl" is not a member of
    >> > System.Web.UI.ControlCollection"
    >> >
    >> > thanks
    >> >
    >> > "Grant Merwitz" wrote:
    >> >
    >> >> i think it should be
    >> >>
    >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    >> >> TextBox).Enabled
    >> >> =
    >> >> False
    >> >>
    >> >> Adding the 'FindControl' in there
    >> >>
    >> >> "NH" <> wrote in message
    >> >> news:D...
    >> >> > the line its failing on is
    >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    >> >> >
    >> >> > Its says "Input string was not in a correct format. "
    >> >> >
    >> >> > "NH" wrote:
    >> >> >
    >> >> >> thanks for the reply.
    >> >> >>
    >> >> >> I get a "Object reference not set to an instance of an object"
    >> >> >> error
    >> >> >> with
    >> >> >> the line
    >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible =
    >> >> >> False
    >> >> >>
    >> >> >> Should the EditItemTemplate control be referenceable in the
    >> >> >> ItemDataBound
    >> >> >> datagrid event? Its as if it doesnt know about the control?
    >> >> >>
    >> >> >> "Grant Merwitz" wrote:
    >> >> >>
    >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    >> >> >> >
    >> >> >> >
    >> >> >> >
    >> >> >> > "NH" <> wrote in message
    >> >> >> > news:...
    >> >> >> > > How can I only display the textbox I have in an
    >> >> >> > > EditItemTemplate
    >> >> >> > > based on
    >> >> >> > > the
    >> >> >> > > value in another cell in the row?
    >> >> >> > >
    >> >> >> > > i.e I only want users to edit one of the cells based on the
    >> >> >> > > value
    >> >> >> > > in
    >> >> >> > > another
    >> >> >> > > cell....
    >> >> >> > >
    >> >> >> > > Should I do this in the ItemDataBound event of the
    >> >> >> > > datagrid...something
    >> >> >> > > like...
    >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    >> >> >> > > dont allow the textbox defined in the EditItemTemplate
    >> >> >> > > to
    >> >> >> > > be
    >> >> >> > > visible
    >> >> >> > > what is the code for this?
    >> >> >> > > End If
    >> >> >> > >
    >> >> >> > > Thanks for your help
    >> >> >> >
    >> >> >> >
    >> >> >> >
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
     
    Grant Merwitz, Aug 11, 2005
    #9
  10. No, tired that too, but got the same Object reference not set to an instance
    of an object" error.

    Is there a way of doing this? It should be simply!!

    "Grant Merwitz" wrote:

    > How about if you try that code in the EditCommand
    >
    > private void DataGrid1_EditCommand(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >
    > {
    >
    > e.Item.FindControl("");
    >
    > }
    >
    >
    >
    > not sure the VB code for that, but accessed through the DataGrid property
    > 'EditCommand'
    >
    >
    > "NH" <> wrote in message
    > news:...
    > > Yeah this is something I tried also, get an ""Object reference not set to
    > > an
    > > instance of an object" error.
    > >
    > > It looks like the EditItemTemplate control is not referenceabnle in the
    > > ItemDataBound event?
    > >
    > > "Grant Merwitz" wrote:
    > >
    > >> sorry, drop out the control bit
    > >>
    > >> e.Item.FindControl("MyControl")
    > >>
    > >>
    > >> "NH" <> wrote in message
    > >> news:...
    > >> > Yes I tried that but it says "FindControl" is not a member of
    > >> > System.Web.UI.ControlCollection"
    > >> >
    > >> > thanks
    > >> >
    > >> > "Grant Merwitz" wrote:
    > >> >
    > >> >> i think it should be
    > >> >>
    > >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    > >> >> TextBox).Enabled
    > >> >> =
    > >> >> False
    > >> >>
    > >> >> Adding the 'FindControl' in there
    > >> >>
    > >> >> "NH" <> wrote in message
    > >> >> news:D...
    > >> >> > the line its failing on is
    > >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    > >> >> >
    > >> >> > Its says "Input string was not in a correct format. "
    > >> >> >
    > >> >> > "NH" wrote:
    > >> >> >
    > >> >> >> thanks for the reply.
    > >> >> >>
    > >> >> >> I get a "Object reference not set to an instance of an object"
    > >> >> >> error
    > >> >> >> with
    > >> >> >> the line
    > >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible =
    > >> >> >> False
    > >> >> >>
    > >> >> >> Should the EditItemTemplate control be referenceable in the
    > >> >> >> ItemDataBound
    > >> >> >> datagrid event? Its as if it doesnt know about the control?
    > >> >> >>
    > >> >> >> "Grant Merwitz" wrote:
    > >> >> >>
    > >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >> >> >> >
    > >> >> >> >
    > >> >> >> >
    > >> >> >> > "NH" <> wrote in message
    > >> >> >> > news:...
    > >> >> >> > > How can I only display the textbox I have in an
    > >> >> >> > > EditItemTemplate
    > >> >> >> > > based on
    > >> >> >> > > the
    > >> >> >> > > value in another cell in the row?
    > >> >> >> > >
    > >> >> >> > > i.e I only want users to edit one of the cells based on the
    > >> >> >> > > value
    > >> >> >> > > in
    > >> >> >> > > another
    > >> >> >> > > cell....
    > >> >> >> > >
    > >> >> >> > > Should I do this in the ItemDataBound event of the
    > >> >> >> > > datagrid...something
    > >> >> >> > > like...
    > >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    > >> >> >> > > dont allow the textbox defined in the EditItemTemplate
    > >> >> >> > > to
    > >> >> >> > > be
    > >> >> >> > > visible
    > >> >> >> > > what is the code for this?
    > >> >> >> > > End If
    > >> >> >> > >
    > >> >> >> > > Thanks for your help
    > >> >> >> >
    > >> >> >> >
    > >> >> >> >
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #10
  11. tried that too, go the same object not set...error

    This should be a simple thing to do, any other ideas? I am tried everything
    I know...

    "Grant Merwitz" wrote:

    > How about if you try that code in the EditCommand
    >
    > private void DataGrid1_EditCommand(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >
    > {
    >
    > e.Item.FindControl("");
    >
    > }
    >
    >
    >
    > not sure the VB code for that, but accessed through the DataGrid property
    > 'EditCommand'
    >
    >
    > "NH" <> wrote in message
    > news:...
    > > Yeah this is something I tried also, get an ""Object reference not set to
    > > an
    > > instance of an object" error.
    > >
    > > It looks like the EditItemTemplate control is not referenceabnle in the
    > > ItemDataBound event?
    > >
    > > "Grant Merwitz" wrote:
    > >
    > >> sorry, drop out the control bit
    > >>
    > >> e.Item.FindControl("MyControl")
    > >>
    > >>
    > >> "NH" <> wrote in message
    > >> news:...
    > >> > Yes I tried that but it says "FindControl" is not a member of
    > >> > System.Web.UI.ControlCollection"
    > >> >
    > >> > thanks
    > >> >
    > >> > "Grant Merwitz" wrote:
    > >> >
    > >> >> i think it should be
    > >> >>
    > >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    > >> >> TextBox).Enabled
    > >> >> =
    > >> >> False
    > >> >>
    > >> >> Adding the 'FindControl' in there
    > >> >>
    > >> >> "NH" <> wrote in message
    > >> >> news:D...
    > >> >> > the line its failing on is
    > >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False
    > >> >> >
    > >> >> > Its says "Input string was not in a correct format. "
    > >> >> >
    > >> >> > "NH" wrote:
    > >> >> >
    > >> >> >> thanks for the reply.
    > >> >> >>
    > >> >> >> I get a "Object reference not set to an instance of an object"
    > >> >> >> error
    > >> >> >> with
    > >> >> >> the line
    > >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible =
    > >> >> >> False
    > >> >> >>
    > >> >> >> Should the EditItemTemplate control be referenceable in the
    > >> >> >> ItemDataBound
    > >> >> >> datagrid event? Its as if it doesnt know about the control?
    > >> >> >>
    > >> >> >> "Grant Merwitz" wrote:
    > >> >> >>
    > >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >> >> >> >
    > >> >> >> >
    > >> >> >> >
    > >> >> >> > "NH" <> wrote in message
    > >> >> >> > news:...
    > >> >> >> > > How can I only display the textbox I have in an
    > >> >> >> > > EditItemTemplate
    > >> >> >> > > based on
    > >> >> >> > > the
    > >> >> >> > > value in another cell in the row?
    > >> >> >> > >
    > >> >> >> > > i.e I only want users to edit one of the cells based on the
    > >> >> >> > > value
    > >> >> >> > > in
    > >> >> >> > > another
    > >> >> >> > > cell....
    > >> >> >> > >
    > >> >> >> > > Should I do this in the ItemDataBound event of the
    > >> >> >> > > datagrid...something
    > >> >> >> > > like...
    > >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    > >> >> >> > > dont allow the textbox defined in the EditItemTemplate
    > >> >> >> > > to
    > >> >> >> > > be
    > >> >> >> > > visible
    > >> >> >> > > what is the code for this?
    > >> >> >> > > End If
    > >> >> >> > >
    > >> >> >> > > Thanks for your help
    > >> >> >> >
    > >> >> >> >
    > >> >> >> >
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #11
  12. GOT IT

    After much fighting with Visual Studio - which kept removing my DataGrid
    events, i found a way
    In your EditCommand method, hide the Column you don't want to show,

    So, if the TextBox will appear in Column 4, in you EditCommand Method do as
    follows:

    private void DataGrid1_EditCommand(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)

    {

    DatGrid1.EditItemIndex = e.Item.ItemIndex;

    BindTopicGrid(this.m_user);

    if(e.Item.Cells(8).Text = "2" then

    DataGrid1.Columns[4].Visible = false;

    End If

    }

    Again, HTH

    "NH" <> wrote in message
    news:...
    > tried that too, go the same object not set...error
    >
    > This should be a simple thing to do, any other ideas? I am tried
    > everything
    > I know...
    >
    > "Grant Merwitz" wrote:
    >
    >> How about if you try that code in the EditCommand
    >>
    >> private void DataGrid1_EditCommand(object source,
    >> System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >>
    >> {
    >>
    >> e.Item.FindControl("");
    >>
    >> }
    >>
    >>
    >>
    >> not sure the VB code for that, but accessed through the DataGrid property
    >> 'EditCommand'
    >>
    >>
    >> "NH" <> wrote in message
    >> news:...
    >> > Yeah this is something I tried also, get an ""Object reference not set
    >> > to
    >> > an
    >> > instance of an object" error.
    >> >
    >> > It looks like the EditItemTemplate control is not referenceabnle in the
    >> > ItemDataBound event?
    >> >
    >> > "Grant Merwitz" wrote:
    >> >
    >> >> sorry, drop out the control bit
    >> >>
    >> >> e.Item.FindControl("MyControl")
    >> >>
    >> >>
    >> >> "NH" <> wrote in message
    >> >> news:...
    >> >> > Yes I tried that but it says "FindControl" is not a member of
    >> >> > System.Web.UI.ControlCollection"
    >> >> >
    >> >> > thanks
    >> >> >
    >> >> > "Grant Merwitz" wrote:
    >> >> >
    >> >> >> i think it should be
    >> >> >>
    >> >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    >> >> >> TextBox).Enabled
    >> >> >> =
    >> >> >> False
    >> >> >>
    >> >> >> Adding the 'FindControl' in there
    >> >> >>
    >> >> >> "NH" <> wrote in message
    >> >> >> news:D...
    >> >> >> > the line its failing on is
    >> >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled =
    >> >> >> > False
    >> >> >> >
    >> >> >> > Its says "Input string was not in a correct format. "
    >> >> >> >
    >> >> >> > "NH" wrote:
    >> >> >> >
    >> >> >> >> thanks for the reply.
    >> >> >> >>
    >> >> >> >> I get a "Object reference not set to an instance of an object"
    >> >> >> >> error
    >> >> >> >> with
    >> >> >> >> the line
    >> >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible
    >> >> >> >> =
    >> >> >> >> False
    >> >> >> >>
    >> >> >> >> Should the EditItemTemplate control be referenceable in the
    >> >> >> >> ItemDataBound
    >> >> >> >> datagrid event? Its as if it doesnt know about the control?
    >> >> >> >>
    >> >> >> >> "Grant Merwitz" wrote:
    >> >> >> >>
    >> >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    >> >> >> >> >
    >> >> >> >> >
    >> >> >> >> >
    >> >> >> >> > "NH" <> wrote in message
    >> >> >> >> > news:...
    >> >> >> >> > > How can I only display the textbox I have in an
    >> >> >> >> > > EditItemTemplate
    >> >> >> >> > > based on
    >> >> >> >> > > the
    >> >> >> >> > > value in another cell in the row?
    >> >> >> >> > >
    >> >> >> >> > > i.e I only want users to edit one of the cells based on the
    >> >> >> >> > > value
    >> >> >> >> > > in
    >> >> >> >> > > another
    >> >> >> >> > > cell....
    >> >> >> >> > >
    >> >> >> >> > > Should I do this in the ItemDataBound event of the
    >> >> >> >> > > datagrid...something
    >> >> >> >> > > like...
    >> >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    >> >> >> >> > > dont allow the textbox defined in the
    >> >> >> >> > > EditItemTemplate
    >> >> >> >> > > to
    >> >> >> >> > > be
    >> >> >> >> > > visible
    >> >> >> >> > > what is the code for this?
    >> >> >> >> > > End If
    >> >> >> >> > >
    >> >> >> >> > > Thanks for your help
    >> >> >> >> >
    >> >> >> >> >
    >> >> >> >> >
    >> >> >>
    >> >> >>
    >> >> >>
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
     
    Grant Merwitz, Aug 11, 2005
    #12
  13. Hi Grant,
    I really appreciate all your effort on this. I really need to keep the
    column visible, its just the txtbox in the EditItemTemplate. Anyway of doin
    it?

    "Grant Merwitz" wrote:

    > GOT IT
    >
    > After much fighting with Visual Studio - which kept removing my DataGrid
    > events, i found a way
    > In your EditCommand method, hide the Column you don't want to show,
    >
    > So, if the TextBox will appear in Column 4, in you EditCommand Method do as
    > follows:
    >
    > private void DataGrid1_EditCommand(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >
    > {
    >
    > DatGrid1.EditItemIndex = e.Item.ItemIndex;
    >
    > BindTopicGrid(this.m_user);
    >
    > if(e.Item.Cells(8).Text = "2" then
    >
    > DataGrid1.Columns[4].Visible = false;
    >
    > End If
    >
    > }
    >
    > Again, HTH
    >
    > "NH" <> wrote in message
    > news:...
    > > tried that too, go the same object not set...error
    > >
    > > This should be a simple thing to do, any other ideas? I am tried
    > > everything
    > > I know...
    > >
    > > "Grant Merwitz" wrote:
    > >
    > >> How about if you try that code in the EditCommand
    > >>
    > >> private void DataGrid1_EditCommand(object source,
    > >> System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > >>
    > >> {
    > >>
    > >> e.Item.FindControl("");
    > >>
    > >> }
    > >>
    > >>
    > >>
    > >> not sure the VB code for that, but accessed through the DataGrid property
    > >> 'EditCommand'
    > >>
    > >>
    > >> "NH" <> wrote in message
    > >> news:...
    > >> > Yeah this is something I tried also, get an ""Object reference not set
    > >> > to
    > >> > an
    > >> > instance of an object" error.
    > >> >
    > >> > It looks like the EditItemTemplate control is not referenceabnle in the
    > >> > ItemDataBound event?
    > >> >
    > >> > "Grant Merwitz" wrote:
    > >> >
    > >> >> sorry, drop out the control bit
    > >> >>
    > >> >> e.Item.FindControl("MyControl")
    > >> >>
    > >> >>
    > >> >> "NH" <> wrote in message
    > >> >> news:...
    > >> >> > Yes I tried that but it says "FindControl" is not a member of
    > >> >> > System.Web.UI.ControlCollection"
    > >> >> >
    > >> >> > thanks
    > >> >> >
    > >> >> > "Grant Merwitz" wrote:
    > >> >> >
    > >> >> >> i think it should be
    > >> >> >>
    > >> >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    > >> >> >> TextBox).Enabled
    > >> >> >> =
    > >> >> >> False
    > >> >> >>
    > >> >> >> Adding the 'FindControl' in there
    > >> >> >>
    > >> >> >> "NH" <> wrote in message
    > >> >> >> news:D...
    > >> >> >> > the line its failing on is
    > >> >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled =
    > >> >> >> > False
    > >> >> >> >
    > >> >> >> > Its says "Input string was not in a correct format. "
    > >> >> >> >
    > >> >> >> > "NH" wrote:
    > >> >> >> >
    > >> >> >> >> thanks for the reply.
    > >> >> >> >>
    > >> >> >> >> I get a "Object reference not set to an instance of an object"
    > >> >> >> >> error
    > >> >> >> >> with
    > >> >> >> >> the line
    > >> >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible
    > >> >> >> >> =
    > >> >> >> >> False
    > >> >> >> >>
    > >> >> >> >> Should the EditItemTemplate control be referenceable in the
    > >> >> >> >> ItemDataBound
    > >> >> >> >> datagrid event? Its as if it doesnt know about the control?
    > >> >> >> >>
    > >> >> >> >> "Grant Merwitz" wrote:
    > >> >> >> >>
    > >> >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >> >> >> >> >
    > >> >> >> >> >
    > >> >> >> >> >
    > >> >> >> >> > "NH" <> wrote in message
    > >> >> >> >> > news:...
    > >> >> >> >> > > How can I only display the textbox I have in an
    > >> >> >> >> > > EditItemTemplate
    > >> >> >> >> > > based on
    > >> >> >> >> > > the
    > >> >> >> >> > > value in another cell in the row?
    > >> >> >> >> > >
    > >> >> >> >> > > i.e I only want users to edit one of the cells based on the
    > >> >> >> >> > > value
    > >> >> >> >> > > in
    > >> >> >> >> > > another
    > >> >> >> >> > > cell....
    > >> >> >> >> > >
    > >> >> >> >> > > Should I do this in the ItemDataBound event of the
    > >> >> >> >> > > datagrid...something
    > >> >> >> >> > > like...
    > >> >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    > >> >> >> >> > > dont allow the textbox defined in the
    > >> >> >> >> > > EditItemTemplate
    > >> >> >> >> > > to
    > >> >> >> >> > > be
    > >> >> >> >> > > visible
    > >> >> >> >> > > what is the code for this?
    > >> >> >> >> > > End If
    > >> >> >> >> > >
    > >> >> >> >> > > Thanks for your help
    > >> >> >> >> >
    > >> >> >> >> >
    > >> >> >> >> >
    > >> >> >>
    > >> >> >>
    > >> >> >>
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?Tkg=?=, Aug 11, 2005
    #13
  14. Sorry man, all out of ideas and time .. home time

    Try start a new post, as not many people will look at this one again - its
    massive :)

    Good luck

    "NH" <> wrote in message
    news:...
    > Hi Grant,
    > I really appreciate all your effort on this. I really need to keep the
    > column visible, its just the txtbox in the EditItemTemplate. Anyway of
    > doin
    > it?
    >
    > "Grant Merwitz" wrote:
    >
    >> GOT IT
    >>
    >> After much fighting with Visual Studio - which kept removing my DataGrid
    >> events, i found a way
    >> In your EditCommand method, hide the Column you don't want to show,
    >>
    >> So, if the TextBox will appear in Column 4, in you EditCommand Method do
    >> as
    >> follows:
    >>
    >> private void DataGrid1_EditCommand(object source,
    >> System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >>
    >> {
    >>
    >> DatGrid1.EditItemIndex = e.Item.ItemIndex;
    >>
    >> BindTopicGrid(this.m_user);
    >>
    >> if(e.Item.Cells(8).Text = "2" then
    >>
    >> DataGrid1.Columns[4].Visible = false;
    >>
    >> End If
    >>
    >> }
    >>
    >> Again, HTH
    >>
    >> "NH" <> wrote in message
    >> news:...
    >> > tried that too, go the same object not set...error
    >> >
    >> > This should be a simple thing to do, any other ideas? I am tried
    >> > everything
    >> > I know...
    >> >
    >> > "Grant Merwitz" wrote:
    >> >
    >> >> How about if you try that code in the EditCommand
    >> >>
    >> >> private void DataGrid1_EditCommand(object source,
    >> >> System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >> >>
    >> >> {
    >> >>
    >> >> e.Item.FindControl("");
    >> >>
    >> >> }
    >> >>
    >> >>
    >> >>
    >> >> not sure the VB code for that, but accessed through the DataGrid
    >> >> property
    >> >> 'EditCommand'
    >> >>
    >> >>
    >> >> "NH" <> wrote in message
    >> >> news:...
    >> >> > Yeah this is something I tried also, get an ""Object reference not
    >> >> > set
    >> >> > to
    >> >> > an
    >> >> > instance of an object" error.
    >> >> >
    >> >> > It looks like the EditItemTemplate control is not referenceabnle in
    >> >> > the
    >> >> > ItemDataBound event?
    >> >> >
    >> >> > "Grant Merwitz" wrote:
    >> >> >
    >> >> >> sorry, drop out the control bit
    >> >> >>
    >> >> >> e.Item.FindControl("MyControl")
    >> >> >>
    >> >> >>
    >> >> >> "NH" <> wrote in message
    >> >> >> news:...
    >> >> >> > Yes I tried that but it says "FindControl" is not a member of
    >> >> >> > System.Web.UI.ControlCollection"
    >> >> >> >
    >> >> >> > thanks
    >> >> >> >
    >> >> >> > "Grant Merwitz" wrote:
    >> >> >> >
    >> >> >> >> i think it should be
    >> >> >> >>
    >> >> >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    >> >> >> >> TextBox).Enabled
    >> >> >> >> =
    >> >> >> >> False
    >> >> >> >>
    >> >> >> >> Adding the 'FindControl' in there
    >> >> >> >>
    >> >> >> >> "NH" <> wrote in message
    >> >> >> >> news:D...
    >> >> >> >> > the line its failing on is
    >> >> >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled =
    >> >> >> >> > False
    >> >> >> >> >
    >> >> >> >> > Its says "Input string was not in a correct format. "
    >> >> >> >> >
    >> >> >> >> > "NH" wrote:
    >> >> >> >> >
    >> >> >> >> >> thanks for the reply.
    >> >> >> >> >>
    >> >> >> >> >> I get a "Object reference not set to an instance of an
    >> >> >> >> >> object"
    >> >> >> >> >> error
    >> >> >> >> >> with
    >> >> >> >> >> the line
    >> >> >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"),
    >> >> >> >> >> TextBox).Visible
    >> >> >> >> >> =
    >> >> >> >> >> False
    >> >> >> >> >>
    >> >> >> >> >> Should the EditItemTemplate control be referenceable in the
    >> >> >> >> >> ItemDataBound
    >> >> >> >> >> datagrid event? Its as if it doesnt know about the control?
    >> >> >> >> >>
    >> >> >> >> >> "Grant Merwitz" wrote:
    >> >> >> >> >>
    >> >> >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible =
    >> >> >> >> >> > false;
    >> >> >> >> >> >
    >> >> >> >> >> >
    >> >> >> >> >> >
    >> >> >> >> >> > "NH" <> wrote in message
    >> >> >> >> >> > news:...
    >> >> >> >> >> > > How can I only display the textbox I have in an
    >> >> >> >> >> > > EditItemTemplate
    >> >> >> >> >> > > based on
    >> >> >> >> >> > > the
    >> >> >> >> >> > > value in another cell in the row?
    >> >> >> >> >> > >
    >> >> >> >> >> > > i.e I only want users to edit one of the cells based on
    >> >> >> >> >> > > the
    >> >> >> >> >> > > value
    >> >> >> >> >> > > in
    >> >> >> >> >> > > another
    >> >> >> >> >> > > cell....
    >> >> >> >> >> > >
    >> >> >> >> >> > > Should I do this in the ItemDataBound event of the
    >> >> >> >> >> > > datagrid...something
    >> >> >> >> >> > > like...
    >> >> >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    >> >> >> >> >> > > dont allow the textbox defined in the
    >> >> >> >> >> > > EditItemTemplate
    >> >> >> >> >> > > to
    >> >> >> >> >> > > be
    >> >> >> >> >> > > visible
    >> >> >> >> >> > > what is the code for this?
    >> >> >> >> >> > > End If
    >> >> >> >> >> > >
    >> >> >> >> >> > > Thanks for your help
    >> >> >> >> >> >
    >> >> >> >> >> >
    >> >> >> >> >> >
    >> >> >> >>
    >> >> >> >>
    >> >> >> >>
    >> >> >>
    >> >> >>
    >> >> >>
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
     
    Grant Merwitz, Aug 11, 2005
    #14
  15. "NH" wrote:

    > thanks for the reply.
    >
    > I get a "Object reference not set to an instance of an object" error with
    > the line
    > CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False
    >
    > Should the EditItemTemplate control be referenceable in the ItemDataBound
    > datagrid event? Its as if it doesnt know about the control?


    The control only exists when e.Item.ItemType = ListItemType.EditItem. The
    ItemDataBound event is triggered for all ListItemTypes but your textbox only
    exists for the EditItem.

    All you need to do is just add an if statement like this:
    If e.Item.ItemType = ListItemType.EditItem Then
    If Not e.Item.FindControl("txtDaysWriteOffed") is Nothing then
    CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible =
    False
    End If
    End If

    ---
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com
    >
    > "Grant Merwitz" wrote:
    >
    > > e.Item.Controls.FindControl("TextBox's Id").Visible = false;
    > >
    > >
    > >
    > > "NH" <> wrote in message
    > > news:...
    > > > How can I only display the textbox I have in an EditItemTemplate based on
    > > > the
    > > > value in another cell in the row?
    > > >
    > > > i.e I only want users to edit one of the cells based on the value in
    > > > another
    > > > cell....
    > > >
    > > > Should I do this in the ItemDataBound event of the datagrid...something
    > > > like...
    > > > If e.Item.Cells(8).Text = "2" Then
    > > > dont allow the textbox defined in the EditItemTemplate to be
    > > > visible
    > > > what is the code for this?
    > > > End If
    > > >
    > > > Thanks for your help

    > >
    > >
    > >
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Aug 11, 2005
    #15
  16. Just posting here to keep your other post clean

    Can you post me some of your code?
    This really shouldn't be so difficult - certainly not a 48 hour problem

    "Grant Merwitz" <> wrote in message
    news:...
    > Sorry man, all out of ideas and time .. home time
    >
    > Try start a new post, as not many people will look at this one again - its
    > massive :)
    >
    > Good luck
    >
    > "NH" <> wrote in message
    > news:...
    >> Hi Grant,
    >> I really appreciate all your effort on this. I really need to keep the
    >> column visible, its just the txtbox in the EditItemTemplate. Anyway of
    >> doin
    >> it?
    >>
    >> "Grant Merwitz" wrote:
    >>
    >>> GOT IT
    >>>
    >>> After much fighting with Visual Studio - which kept removing my DataGrid
    >>> events, i found a way
    >>> In your EditCommand method, hide the Column you don't want to show,
    >>>
    >>> So, if the TextBox will appear in Column 4, in you EditCommand Method do
    >>> as
    >>> follows:
    >>>
    >>> private void DataGrid1_EditCommand(object source,
    >>> System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >>>
    >>> {
    >>>
    >>> DatGrid1.EditItemIndex = e.Item.ItemIndex;
    >>>
    >>> BindTopicGrid(this.m_user);
    >>>
    >>> if(e.Item.Cells(8).Text = "2" then
    >>>
    >>> DataGrid1.Columns[4].Visible = false;
    >>>
    >>> End If
    >>>
    >>> }
    >>>
    >>> Again, HTH
    >>>
    >>> "NH" <> wrote in message
    >>> news:...
    >>> > tried that too, go the same object not set...error
    >>> >
    >>> > This should be a simple thing to do, any other ideas? I am tried
    >>> > everything
    >>> > I know...
    >>> >
    >>> > "Grant Merwitz" wrote:
    >>> >
    >>> >> How about if you try that code in the EditCommand
    >>> >>
    >>> >> private void DataGrid1_EditCommand(object source,
    >>> >> System.Web.UI.WebControls.DataGridCommandEventArgs e)
    >>> >>
    >>> >> {
    >>> >>
    >>> >> e.Item.FindControl("");
    >>> >>
    >>> >> }
    >>> >>
    >>> >>
    >>> >>
    >>> >> not sure the VB code for that, but accessed through the DataGrid
    >>> >> property
    >>> >> 'EditCommand'
    >>> >>
    >>> >>
    >>> >> "NH" <> wrote in message
    >>> >> news:...
    >>> >> > Yeah this is something I tried also, get an ""Object reference not
    >>> >> > set
    >>> >> > to
    >>> >> > an
    >>> >> > instance of an object" error.
    >>> >> >
    >>> >> > It looks like the EditItemTemplate control is not referenceabnle in
    >>> >> > the
    >>> >> > ItemDataBound event?
    >>> >> >
    >>> >> > "Grant Merwitz" wrote:
    >>> >> >
    >>> >> >> sorry, drop out the control bit
    >>> >> >>
    >>> >> >> e.Item.FindControl("MyControl")
    >>> >> >>
    >>> >> >>
    >>> >> >> "NH" <> wrote in message
    >>> >> >> news:...
    >>> >> >> > Yes I tried that but it says "FindControl" is not a member of
    >>> >> >> > System.Web.UI.ControlCollection"
    >>> >> >> >
    >>> >> >> > thanks
    >>> >> >> >
    >>> >> >> > "Grant Merwitz" wrote:
    >>> >> >> >
    >>> >> >> >> i think it should be
    >>> >> >> >>
    >>> >> >> >> CType(e.Item.Controls.FindControl("txtDaysWriteOffed"),
    >>> >> >> >> TextBox).Enabled
    >>> >> >> >> =
    >>> >> >> >> False
    >>> >> >> >>
    >>> >> >> >> Adding the 'FindControl' in there
    >>> >> >> >>
    >>> >> >> >> "NH" <> wrote in message
    >>> >> >> >> news:D...
    >>> >> >> >> > the line its failing on is
    >>> >> >> >> > CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled
    >>> >> >> >> > =
    >>> >> >> >> > False
    >>> >> >> >> >
    >>> >> >> >> > Its says "Input string was not in a correct format. "
    >>> >> >> >> >
    >>> >> >> >> > "NH" wrote:
    >>> >> >> >> >
    >>> >> >> >> >> thanks for the reply.
    >>> >> >> >> >>
    >>> >> >> >> >> I get a "Object reference not set to an instance of an
    >>> >> >> >> >> object"
    >>> >> >> >> >> error
    >>> >> >> >> >> with
    >>> >> >> >> >> the line
    >>> >> >> >> >> CType(e.Item.FindControl("txtDaysWriteOffed"),
    >>> >> >> >> >> TextBox).Visible
    >>> >> >> >> >> =
    >>> >> >> >> >> False
    >>> >> >> >> >>
    >>> >> >> >> >> Should the EditItemTemplate control be referenceable in the
    >>> >> >> >> >> ItemDataBound
    >>> >> >> >> >> datagrid event? Its as if it doesnt know about the control?
    >>> >> >> >> >>
    >>> >> >> >> >> "Grant Merwitz" wrote:
    >>> >> >> >> >>
    >>> >> >> >> >> > e.Item.Controls.FindControl("TextBox's Id").Visible =
    >>> >> >> >> >> > false;
    >>> >> >> >> >> >
    >>> >> >> >> >> >
    >>> >> >> >> >> >
    >>> >> >> >> >> > "NH" <> wrote in message
    >>> >> >> >> >> > news:...
    >>> >> >> >> >> > > How can I only display the textbox I have in an
    >>> >> >> >> >> > > EditItemTemplate
    >>> >> >> >> >> > > based on
    >>> >> >> >> >> > > the
    >>> >> >> >> >> > > value in another cell in the row?
    >>> >> >> >> >> > >
    >>> >> >> >> >> > > i.e I only want users to edit one of the cells based on
    >>> >> >> >> >> > > the
    >>> >> >> >> >> > > value
    >>> >> >> >> >> > > in
    >>> >> >> >> >> > > another
    >>> >> >> >> >> > > cell....
    >>> >> >> >> >> > >
    >>> >> >> >> >> > > Should I do this in the ItemDataBound event of the
    >>> >> >> >> >> > > datagrid...something
    >>> >> >> >> >> > > like...
    >>> >> >> >> >> > > If e.Item.Cells(8).Text = "2" Then
    >>> >> >> >> >> > > dont allow the textbox defined in the
    >>> >> >> >> >> > > EditItemTemplate
    >>> >> >> >> >> > > to
    >>> >> >> >> >> > > be
    >>> >> >> >> >> > > visible
    >>> >> >> >> >> > > what is the code for this?
    >>> >> >> >> >> > > End If
    >>> >> >> >> >> > >
    >>> >> >> >> >> > > Thanks for your help
    >>> >> >> >> >> >
    >>> >> >> >> >> >
    >>> >> >> >> >> >
    >>> >> >> >>
    >>> >> >> >>
    >>> >> >> >>
    >>> >> >>
    >>> >> >>
    >>> >> >>
    >>> >>
    >>> >>
    >>> >>
    >>>
    >>>
    >>>

    >
    >
     
    Grant Merwitz, Aug 12, 2005
    #16
    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. Trevor Hartman

    datagrid edititemtemplate for dates

    Trevor Hartman, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    369
    Trevor Hartman
    Jul 16, 2003
  2. SStory

    Datalist EditItemTemplate

    SStory, Aug 19, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    500
    SStory
    Aug 19, 2003
  3. Dave
    Replies:
    1
    Views:
    533
  4. Kevin Quigley

    asp:hyperlink in EditItemTemplate

    Kevin Quigley, Dec 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    365
    Kevin Quigley
    Dec 2, 2003
  5. Replies:
    1
    Views:
    497
    Teemu Keiski
    Jun 22, 2005
Loading...

Share This Page