Cannot access the controls of a page found in a datagrid control

Hello All,

I am trying to access the RadioButtonList controls of an aspx page using this code:
..........................................................................................................
Dim ctl As Control
Dim answers As ArrayList

For Each ctl In Page.Controls(1).Controls

   If TypeOf ctl Is RadioButtonList Then 

      If not CType(ctl, RadioButtonList).SelectedItem Is Nothing Then 

         Try 
         answers.Add(CType(ctl, RadioButtonList).SelectedItem.Value) 
         Session("MathSkills_Answers")= answers 
         Catch ex As Exception 
         end Try 

      End If 

   End If

Next
............................................................................................................



However, I can access the controls outside a datagrid but not the ones inside a datagrid.
Is there anyway I can access the controls inside a datagrid?
To explain in more details, I am writing an application for an employment screening process where the questions and answer options are fed by a database. I bounded the data to a datagrid and bounded the answer options to a radiobuttonlist control found on each row of the datagrid. The Ids for the radiobuttonlist are set dynamically. I need to retrieve and store the values of the selected items of the radiobuttonlists.

Thank you for your help

0
donjaber
11/16/2005 8:02:46 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

0 Replies
588 Views

Similar Articles

[PageSpeed] 35

Reply:

Similar Artilces:

How to access page control (editor control) from user control?
Hi, I want to do something, but I don't know if it's even possible. I'm trying to make a simple application to edit my website. I have a page called editPage.aspx which contains an editor control. (cuteEditor from cutesoft) I also have a Treeview that dynamically populates my website structure. I placed this treeview in a custom control (populateTreeView.ascx) and placed it on the editPage.aspx page. When you click on a html file in the treeview (inside the custom control) I check if the file exists. If it does exists I send it to a class which retrieves the editable region within this ...

Control of the page and the controls on a page
I am building a web app that has some pages that are public and some that are only available based on subscription. Could someone explain the best way (infrastructure wise) how to control whether a server control is visible or enabledand how to control whether a page is viewable or not based on the user and whether or not the user is logged in (or not). If a user is not logged in I would like some controls to be visible but disabled. I also have to control the URL's in case a person learnsthe URL and tries to type it in. My question is more towards how to do this database wise. I am u...

Accessing controls on user control page
I have a main page that interfaces with a web service and returns a dataset.  I also have a user control page that contains a datagrid.  I have the user control registered and displaying on the main page.  However, I don't know how to gain access to the datagrid on the user control from the code on the main page.  There doesn't seem to be a way to directly assign values to the properties of the datagrid like you could if it were on the main page itself.  I can't seem to just do:GridView1.DataSource = Contact; GridView1.DataBind();  because I can...

page access control in custom control?
 hi,I'm planning to building a custom control, to be used with membership/roles, so on the page it will look something like this:<abc:MyControl>   <Admin>   ....   </Admin>  <Developer>...</Developer>  <QA>...</QA></abc:MyControl> so that each section will be shown just to the roles assigned to the user.  now the question is say i drop a dataGrid into one of them, how do i access it?  I don't want to do it at the control level, as the control can be used elsewhere and not have a dat...

Need to access a Label Control on the Master Page from a user control attached to a content page
Hello all, I have a master page (say  site.master)  with a status Label in it. I have a content page ( say content.aspx)  that has a user control (say usercontrol.ascx). One of the Button Click Events in the usercontrol.ascx needs to pass on some text onto the status label on the masterpage(LabelStatusMsg) and display it. I have been able to do this directly off a content page (content.aspx) by using the following code (VB)  on the master page <%@ MasterType virtualpath="~/site.master" %> and Dim mpLabel As Label = CType(Master.FindControl("LabelStatusMsg"),...

i have 3 pages student information , i filled two pages ,then go to 3rd page . First Two pages iam having 100 controls.how to store that controls and how to send these controls into 3rd page in ?
i have 3 pages student information , i filled two pages ,then go to 3rd page . First Two pages iam having 100 controls.how to store that controls and how to send these controls into 3rd page in ?  There are a number of ways storing values. Check out: http://msdn2.microsoft.com/en-us/library/75x4ha6s.aspxhttp://www.csharphelp.com/archives/archive207.html Thanks,Karan~ Remember To Mark The Post(s) That Helped You As The ANSWER ~ Hi, Welcome to asp.net forums. Now as far as your requirements goes, the first thing that strikes me is that 100 controls are way too many to kee...

access parent page controls in a user control
 hi guys   i am using two user controls with in a user control and this main user is added to a page.How can i access the main user control's methods, controls from the child user control and vice versa?also i want to access the controls,methods of main user control from page and vice versa.. Hari Krishnantechiebuddy.com Hi,In order to use methods of child controls make the methods you need public and call them in the parent user control.In order to use controls within child controls make public properties that expose the relevant operations for the inner controls of you...

Accessing web controls from within a DataGrid control
Hi, Could someone tell me how to access other web controls from within a datagrid control? I have a ListBox control in a DataGrid, but can't figure out how to set the ListBox's datasource from the code behind. Any help would be great appreciated. Thanks. With the DataGrid you have the ItemDataBound event, where you can find any web control that were added to it, for each row listed in the DataGrid. Ex: Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound If e.Item....

Access controls on host page from a user control
Is it possible to access web server controls on a aspx page from a user control which is hosted by this aspx page. cheers Hi, Suppose you have a textbox in your page named txtFirstName and you want to get that value when the user clicks a button on the User Control. On the click event of the User Control Button write the following linesControl txtFirstNameControl = this.Page.FindControl("txtFirstName"); lblStatus.Text = ((TextBox)txtFirstNameControl).Text; Happy programming,Anton Thanks Anton. It worked. Cheers    ...

How to access a master page control in a user control.
Hi All, I need to access a scriptmanager control placed in a Master page. The scriptmanager is used to RegisterClientScript in the Custom User Control.  The UserControl is placed in a child web page of the Master page. How do I do this? Thanks in advance, Rohan.      There's a ScriptManagerProxy control you can use for this; just drop it onto the user control and you can use that instead....

Accessing control on user control from aspx page
Is it possible to access, say an image to make not visible on a user control, .ascx, from an aspx page containing that control? That is, in the code behind from the .aspx page, making an image.visible=false on the .ascx page. Thanks all, Zath your user control should expose a public property such as: ImageVisible from the container (the page), you'd set that usercontrols property to true or false. from the usercontrol (perhaps in the prerender event), youd set the visibility of the image based on the value of the ImageVisible property. you should not directly manipulate ...

Access controls in User Control in Page Load
What is the better way of getting values from a user control in the load event of the page containing the user control. In my scenario the user control has some drop downs and based on the selections it gather info from the db through ajax. Now I want to access these values and selected values on load event of the container. One way to do this is to make public 0width textboxes in user control and then access them in postback. But that is i guess the pathetic way as different browsers will render 0width textboxes in their own style also i have to make them public which i am not comfortable w...

access controls in user control on a master page
Have a simple question.. I have a dropdown list in a user control within a master page.When I change selection in ddl, I want to access value on the content page.For that, right now I need to refresh the page.. don't know why.. one way around this cud be to declare a public property for UserControl and access it, but I can ONLY see this UserControl in MasterPage... not in a content pageWhile rendering, first content page loads, then MasterPage.. so I can not access changed/current value in the dropdown.. Can someone help?-------------------------------------------------Click on &...

How to access master page controls from .ascx controls?
I have a site where a master page is defined with a placeholder control in it. In the content page I have am accessing various ascx controls from within webpanels (each panel loads an associated ascx file). In one of the ascx files, I want to programmatically change the content of the placeholder that I put on the master page. How do you access this? E.g. Master page :- .... <asp:placeholder id="BreadCrumbs" runat="server" /> ..... In my default.aspx page I have :- ..... <asp:contentwebpart id...

Web resources about - Cannot access the controls of a page found in a datagrid control - asp.net.getting-started

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Out-of-control car hits Ballajura pedestrians and puts four teens in hospital
Four teenagers were injured in Ballajura on Saturday night when an out-of-control car careered into them.

Is Hillary Clinton sorry she reacted to the San Bernardino massacre with a call for more gun control ...
... "Gun safety" has traditionally meant handling your guns safely, but now it's supposed to mean what has more commonly been called "gun control." ...

Trump pushes alternative to gun control after attack
Billionaire hits back against New York Times editorial calling for stronger gun control in wake of San Bernardino massacre

Porsche To Mission E Control: We Are Clear For Launch!
... handling of a Porsche. The contrast seemed to start early cries of the Mission E being the next Tesla [&hellip Porsche To Mission E Control: ...

EU could soon have border controls
EU ministers have agreed to press ahead with plans to suspend the Schengen passport-free travel zone, the FT reports.

CNN's Smerconish Brings On GOP Ratf*er Karl Rove To Opine Over Partisan Divide On Gun Control
... was time to pray. The New York Daily News ran a controversial cover noting that God wouldn't fix this. Democrats again made calls for gun control. ...

Attorney General Says Obama Could Call For Congressional Action For More Gun Control
Attorney General Says Obama Could Call For Congressional Action For More Gun Control

Open thread for night owls: First U.S. birth control clinic lasted just 10 days before being raided
... Parenthood Only Lasted for 10 Days but Started a Revolution . An excerpt: During her time in Europe, Sanger had seen Norwegian birth control ...

San Bernardino Shooting: National Rifle Association rubbishes Obama's gun-control appeal
San Bernardino Shooting: National Rifle Association rubbishes Obama's gun-control appeal - Hitting out at Barack Obama for politicising the incident, ...

Resources last updated: 12/7/2015 3:55:46 AM