Re: EditItemTemplate question
- From: "Grant Merwitz" <grant@xxxxxxxxxxxxx>
- Date: Fri, 12 Aug 2005 12:20:20 +0100
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" <grant@xxxxxxxxxxxxx> wrote in message
news:e9jj9VpnFHA.1416@xxxxxxxxxxxxxxxxxxxxxxx
> 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" <NH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:E7311EC4-ECEC-4C62-8D3E-513F3F05E0C5@xxxxxxxxxxxxxxxx
>> 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" <NH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>> news:984A8CD7-D692-412E-8761-F4BF87A19B5C@xxxxxxxxxxxxxxxx
>>> > 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" <NH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>> >> news:980492AF-5CFC-43E1-8930-3AF8D7ABF413@xxxxxxxxxxxxxxxx
>>> >> > 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" <NH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>> >> >> news:BDA34842-B4C9-4484-BE96-24CB29744D86@xxxxxxxxxxxxxxxx
>>> >> >> > 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" <NH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>> >> >> >> news:D1A240BF-CD1D-45CE-ACDC-6A1A2251FF82@xxxxxxxxxxxxxxxx
>>> >> >> >> > 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" <NH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>> >> >> >> >> > news:E40C9569-725A-4DDE-9100-2BFFA140A32B@xxxxxxxxxxxxxxxx
>>> >> >> >> >> > > 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
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >>
>>> >> >>
>>> >> >>
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>
>
>
.
- References:
- EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: Grant Merwitz
- Re: EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: Grant Merwitz
- Re: EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: Grant Merwitz
- Re: EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: Grant Merwitz
- Re: EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: Grant Merwitz
- Re: EditItemTemplate question
- From: NH
- Re: EditItemTemplate question
- From: Grant Merwitz
- EditItemTemplate question
- Prev by Date: Re: Vb.Net or C#.Net
- Next by Date: Re: Unusual cookie bug!
- Previous by thread: Re: EditItemTemplate question
- Next by thread: Re: EditItemTemplate question
- Index(es):