Refresh Form Based on Selection

Greetings all!

I have created a simple form. I'm trying to set it up so some questions only display based on your answer to other questions. If a person selects a radio button option of YES I would like to show the controls that relate to answering yes to that question. I'm thinking I can do something like this....

Private Sub RadioButtonList2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButtonList2.SelectedIndexChanged
If RadioButtonList2.SelectedValue = "Yes" Then
'Code to refresh the page and save values????
Label1.Visible = True
TextBox1.Visible = True
End If
End Sub

I'm thinking I can have the items visible property set to false when the form first loads. My question is how do I force the form to refresh and STILL keep the values already entered in the form? Is this possible?
0
ebrewington
2/26/2004 9:02:38 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

5 Replies
522 Views

Similar Articles

[PageSpeed] 19

Sure. Just set the "Autopostback" property on your radiobutton list to "True" and all will  be well.

One 'gotcha that stings a lot of newbies is forgetting to check "IsPostBack" in Page_Load and databinding their lists on every time instead of only the first time through (when IsPostBack is False).

Jim


MS MVP ASP.NET [VC++/MFC emeritus]


Old Dog Learns New Tricks

Preferred programming language: cuneiform on clay tablets
0
JimRoss
2/26/2004 9:05:03 PM
Worked like a charm.

I LOVE ASP.NET....
You should have seen the code I had to write in Javascript to do this with old ASP....
0
ebrewington
2/26/2004 9:20:36 PM
I think I spoke too soon...  

It works BUT is there a way to return focus back to the control that the user clicked? Right it goes to the top of the screen and user has to scroll down to continue filling out the form...
Thanks again!
0
ebrewington
2/27/2004 4:33:03 AM
There's a free control that will do this for you:


Free SmartScroller Control
Louis Estrada, Strength Technologies
Jim


MS MVP ASP.NET [VC++/MFC emeritus]


Old Dog Learns New Tricks

Preferred programming language: cuneiform on clay tablets
0
JimRoss
2/27/2004 4:02:44 PM
My last statement stands.  I love ASP.NET.

Thanks Jim. That worked perfectly.
0
ebrewington
2/27/2004 5:34:04 PM
Reply:

Similar Artilces:

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Form: Focus on selected values in dropdownlists, Refresh after selection and hidding formfields based on selection.
Hello again,I have a form with several dropdown lists. Depending on the selected value in the dropdown lists other fields become available in that same form. It is working in classic ASP in combination of JavaScript. I want to migrate it to ASP.NET. I have posted a part of the form at the end of this post.My questions:1. I use <option <%If iFood="0" then%>selected<%End If%> value="0">No value selected</OPTION> to select the selected item when the form is reloaded after the selecting. I know that this also works in ASP.NET, but isn't there a typical ASP....

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

Load Text box of one web form with selected list item of list box of another web form
one help please Problem is i have two web forms  1.  ForiegnkeyTest.aspx  2. foroginkeytable.aspx   step 1 1 ForiegnkeyTest.aspx one web form <head runat="server"><script language="javascript" type="text/javascript">   function popWin()   {         var confirmWin = null;      confirmWin = window.open('foroginkeytable.aspx','anycontent',   'width=455,height=435,status');   }  </script> &...

how to place a <form> in web form form
i placed a <form> in the web form, but i can't submit coz i neet to submit to another web site how can i do??? Mike Chan You cannot submit a <form> to another page if you have a RunAt="Server" in the form tag. Remove that RunAt="Server" and you can (though then you will need to use plain old HTML inside that form). What are you trying to do? Why do you need to post to another form?Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog COZ I NEED TO POST SOME INFORMATION TO ANOTHER WEB SITE IS THERE ANY OTHER SOLUTION?M...

How to launch a windows forms-based application on the web form?
I want to launch a windows forms based app on a local computer when the user clicks on a link on the web form. How can I achieve this function? Many Thx! You can put a file link: Click Here Otherwise, you're trying to overcome the browser's built-in security and will have to use a ActiveX control or something similar....

For interrupting.web form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form
Web Form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form ! Because of my pool English, if you can't see , I will explain more ! ThanksGambler is the real life I guess you mean when form grows it also grow parent div element. This is normal. If you want div to stay fixed size and rather clip the form and maybe show a scrollbar, look at overflow property in CSS.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no ...

Forms or No Forms
Hope this isn't a repeat.  I looked and didn't find anything. Say for example you had a web page with around 20 fields retrive and update to a database with differing datatypes.  Some fields will have some special controls (dropdowns, radios, buttons, etc) that interact with other parts of the page.  What is the best and/or most efficient code to make the page. Would you use a Formview bound to a standard ADO.net SQL connection and edit the templates. Use a Formview bound to an Object Data Source and edit within the templates. Or use an Object Data Source and bind the...

Include web form inside web form
I tried to include an aspx file in a asp.net web form. However, all the web controls (textbox, button) in the included page are not displayed when called. <Form id="Form1" method="post" runat="server"> <%   Response.writeFile("subPage.aspx"); %> <asp:button id="btnPrev" runat="server" text="Previous"></asp:button> </Form> There are some <asp:textbox> controls in the subPage.aspx file, the file itself works fine, but when it is included in the main page, all the controls are not displayed. Please assist. Thanks   u should u...

calling a web form from another web form
I would like to know what is the best way to open a web form from another web form. I would like to call it from a button control. Thanks Well, if I've grasped your question right, there are many methods to do that: 1)Response.Redirect > To navigate to another page from code and is equal to clicking a hyperlink. I suggest this as I think it's closer to your question. 2)Server.Transfer > This ends the current web form and begins a new web form. It's usable when you want to pass some variables i.e (Label1.Text) to the next immediate page. It's not safe though and not used to send p...

Web Form embedded in another Web Form
Hi,  I have programmed a Web Form which acts like a scientific calculator. I would like to embedd this calculator in the upper left hand corner of another accounting Web Form. I don't want to host the calculator on the same server as the accounting page. I.e. I want them to have distinct URLs. Classically, I would do this using frames, but is there a better way using ASP? Is there some sort of Panel which can display the webpage at a specific URL which I can just drag onto my accounting Web Form? Thanks,  P1000   Frames are the only way to embed a webform inside ano...

Web Form vs. Web Content Form
If you don't mind, I would like to know what is the difference between those two items, when I go to add a new item I see both of those and I don't know what the difference is.  A content form is for use with a masterpage. A web form is a standalone web page. If you select web content form, you will then have to specify a masterpage for it. and what is a master page used for?  Hi, a master page is used to give a constant look and theme to a site, without having to duplicate code. So basically you can put your header, menu, nav and footer on a master page. Then a...

Web resources about - Refresh Form Based on Selection - asp.net.web-forms

Selection - 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 ...

Multi-state plans and selection problems
... often similar in design. In fact, it may be hard for consumers to tell them apart. The short answer is network and the longer answer is selection. ...

Doc Rivers Comments on If Kobe Bryant Deserves NBA All-Star Game 2016 Selection - Bleacher Report
Kobe Bryant is getting the legend treatment for the All-Star Game in his final NBA season, and that's totally fine with Los Angeles Clippers ...

Running back LeSean McCoy the lone Pro Bowl selection for Bills
LeSean McCoy's first season with the Buffalo Bills will end with a trip to the Pro Bowl. Maybe. The running back was the lone member of the team ...

Hulu to offer lulu of a video selection
Site created by NBC Universal and News Corp. to debut Wednesday with shows from more than 50 TV networks, cable stations, and movie studios. ...

After Protest, VA Rescinds Selection Of Phoenix VA Overseer Who Misled Congress About Wait Times
After Protest, VA Rescinds Selection Of Phoenix VA Overseer Who Misled Congress About Wait Times

Return of Yuvraj, Nehra: Selection gamble may just be the tonic India need
There were quite a few surprises thrown by the selectors as they announced the squads for Australia tour, with Yuvraj and Nehra's selection the ...

Prices For CFP and Bowl Game Tickets Dropping On Secondary Market After Selection Sunday
The College Football Playoff and bowl schedule are officially set, and ticket prices have already begun to fall on the secondary market. Both ...

Today’s selection of articles from Kotaku’s reader-run community: Naruto Shippuden
Today’s selection of articles from Kotaku ’s reader-run community: Naruto Shippuden - The Filler Free Viewing Guide (Pt. III) • Spacemon: A Pokémon ...

AP PHOTOS: A selection of pictures from the past week
Albuquerque’s source for local news and live streaming video online. KRQE reports on news, weather, traffic, investigations and sports for New ...

Resources last updated: 12/28/2015 7:14:39 PM