PC Review


Reply
Thread Tools Rate Thread

Can't Find My Controls

 
 
Joe
Guest
Posts: n/a
 
      30th Sep 2009
Hi,

I have an ASP.NET web page with a radio button list on it.
When I go to the .vb code behind module and attempt to reference the
radio button list, it tells me that the control does not exist. My
aspx code is below:

<InsertItemTemplate>
<table border="1">
..........
<tr>
<td> <asp:RadioButtonList ID="rbtnNewEstimate"
runat="server" AutoPostBack="True" >
<asp:ListItem>Create A New Estimate </
asp:ListItem>
<asp:ListItem>Create A New Estimate, Based On An
Existing Estimate</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</table>

In my VB code I am attempting to do this

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
rbtnNewEstimate.Checked = ......
End Sub

But it cannot see rbtnNewEstimate. Can anyone tell me why my VB
page does not "see" the controls on my web page?

 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      30th Sep 2009
On Sep 30, 11:37*am, Joe <delphi...@cox.net> wrote:
> Hi,
>
> * * * * *I have an ASP.NET web page with a radio button list onit.
> When I go to the .vb code behind module and attempt to reference the
> radio button list, it tells me that the control does not exist. * My
> aspx code is below:
>
> <InsertItemTemplate>
> * * * * * *<table border="1">
> * * * * * * ..........
> * * * * * * *<tr>
> * * * * * * * *<td> <asp:RadioButtonList ID="rbtnNewEstimate"
> runat="server" AutoPostBack="True" >
> * * * * * * * * * * * <asp:ListItem>Create A New Estimate </
> asp:ListItem>
> * * * * * * * * * * * <asp:ListItem>Create A New Estimate, Based On An
> Existing Estimate</asp:ListItem>
> * * * * * * * * * * </asp:RadioButtonList>
> * * * * * * * *</td>
> * * * * * * *</tr>
> * * * * * * </table>
>
> In my VB code I am attempting to do this
>
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
> * * * * rbtnNewEstimate.Checked = ......
> * * End Sub
>
> But it cannot see rbtnNewEstimate. * *Can anyone tell me why my VB
> page does not "see" the controls on my web page?


I should also add that the controls that I need to access are inside
of a FormView control.

 
Reply With Quote
 
Rob Hill
Guest
Posts: n/a
 
      29th Dec 2009
It appears that you are using a FormView or some other databound control.

You can reference the control as such:

RadioButtonList rbtnNewEstimate =
(RadioButtonList)MyFormView.FindControl("rbtnNewEstimate");

This is C#, I don't know the VB syntax.

Also, you can create the event in the designer for the
RadioButtonList.Clicked event and it will store this information in the
markup. That's how I do it.

Thanks,

Rob Hill


"Joe" <(E-Mail Removed)> wrote in message
news:6c35bb42-f3bd-4a56-9da8-(E-Mail Removed)...
On Sep 30, 11:37 am, Joe <delphi...@cox.net> wrote:
> Hi,
>
> I have an ASP.NET web page with a radio button list on it.
> When I go to the .vb code behind module and attempt to reference the
> radio button list, it tells me that the control does not exist. My
> aspx code is below:
>
> <InsertItemTemplate>
> <table border="1">
> ..........
> <tr>
> <td> <asp:RadioButtonList ID="rbtnNewEstimate"
> runat="server" AutoPostBack="True" >
> <asp:ListItem>Create A New Estimate </
> asp:ListItem>
> <asp:ListItem>Create A New Estimate, Based On An
> Existing Estimate</asp:ListItem>
> </asp:RadioButtonList>
> </td>
> </tr>
> </table>
>
> In my VB code I am attempting to do this
>
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
> rbtnNewEstimate.Checked = ......
> End Sub
>
> But it cannot see rbtnNewEstimate. Can anyone tell me why my VB
> page does not "see" the controls on my web page?


I should also add that the controls that I need to access are inside
of a FormView control.

 
Reply With Quote
 
Abdul Sami
Guest
Posts: n/a
 
      30th Dec 2009
As you are saying that you are using formview to embed controls then you will
use
in VB
Dim RadioButtonListName As RadiobuttonList =
CType(FormView1.FindControl("RadioButtonListName"), RadiobuttonList)


--
Abdul Sami


"Rob Hill" wrote:

> It appears that you are using a FormView or some other databound control.
>
> You can reference the control as such:
>
> RadioButtonList rbtnNewEstimate =
> (RadioButtonList)MyFormView.FindControl("rbtnNewEstimate");
>
> This is C#, I don't know the VB syntax.
>
> Also, you can create the event in the designer for the
> RadioButtonList.Clicked event and it will store this information in the
> markup. That's how I do it.
>
> Thanks,
>
> Rob Hill
>
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:6c35bb42-f3bd-4a56-9da8-(E-Mail Removed)...
> On Sep 30, 11:37 am, Joe <delphi...@cox.net> wrote:
> > Hi,
> >
> > I have an ASP.NET web page with a radio button list on it.
> > When I go to the .vb code behind module and attempt to reference the
> > radio button list, it tells me that the control does not exist. My
> > aspx code is below:
> >
> > <InsertItemTemplate>
> > <table border="1">
> > ..........
> > <tr>
> > <td> <asp:RadioButtonList ID="rbtnNewEstimate"
> > runat="server" AutoPostBack="True" >
> > <asp:ListItem>Create A New Estimate </
> > asp:ListItem>
> > <asp:ListItem>Create A New Estimate, Based On An
> > Existing Estimate</asp:ListItem>
> > </asp:RadioButtonList>
> > </td>
> > </tr>
> > </table>
> >
> > In my VB code I am attempting to do this
> >
> > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Me.Load
> > rbtnNewEstimate.Checked = ......
> > End Sub
> >
> > But it cannot see rbtnNewEstimate. Can anyone tell me why my VB
> > page does not "see" the controls on my web page?

>
> I should also add that the controls that I need to access are inside
> of a FormView control.
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using vba to find a controls name =?Utf-8?B?bWlrZWpzMjAwMA==?= Microsoft Access Form Coding 5 27th Jan 2006 05:46 PM
Find controls Anonymous Microsoft ASP .NET 3 11th Feb 2005 03:31 PM
Find controls ? Kevin Spencer Microsoft ASP .NET 2 1st Oct 2004 03:22 PM
where to find new controls.. Eric BOUXIROT Microsoft VB .NET 0 23rd Dec 2003 06:57 PM
find controls neeme Microsoft Dot NET Compact Framework 2 5th Dec 2003 02:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:42 PM.