Re: cannot find control within control
- From: "Daves" <dbspam@xxxxxxxxx>
- Date: Tue, 12 Apr 2005 13:27:35 -0000
thx Karl, tried that and bloody error "Object reference not set to an
instance of an object."
Button Button1 = (Button) FormView1.Row.FindControl("Button1");
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:O3NhaI2PFHA.2132@xxxxxxxxxxxxxxxxxxxxxxx
> Being too lazy to load up VWD, try using:
> FormView1.Row.FindControl("Button1")
>
> In a repeater, you'd have multiple "Button1"'s and would need to look at
> repeater.Items[i].FindControl
>
> FormViews are the same..though there's only 1 row...so it's exposed as Row
> (if I remember correctly).
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Daves" <dbspam@xxxxxxxxx> wrote in message
> news:us4oQz1PFHA.1500@xxxxxxxxxxxxxxxxxxxxxxx
>> hi,
>> sorry for re-posting but it's a simple question and ought to have a very
>> simple solution; I am trying to use Findcontrol to grab a Button control
>> within a Formview control:
>>
>> <form ID="Form1" runat="server">
>> <asp:FormView ID="FormView1" Runat="server">
>> <ItemTemplate>
>> <asp:Button ID="Button1" runat="server" Text="Breyta"
> CommandName="Edit"/>
>> ...
>>
>> This is what won't work:
>> Button Button1 = (Button) FormView1.FindControl("Button1");
>>
>>
>
>
.
- References:
- cannot find control within control
- From: Daves
- cannot find control within control
- Prev by Date: RE: oh no! another datagrid dropdown question!
- Next by Date: RE: Session not set.
- Previous by thread: cannot find control within control
- Next by thread: Re: cannot find control within control
- Index(es):