Every Action in FormView Fires RadioButtonList OnSelectedIndexChanged Event

 I have a RadioButtonList in a FormView with its OnSelectedIndexChanged event defined.  Whenever I cause any other events on the page, the RadioButtonList's OnSelectedIndexChanged event always gets fired first.  Any ideas?

0
SteveAtSLC
5/4/2009 3:25:36 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

8 Replies
1209 Views

Similar Articles

[PageSpeed] 40

Are you setting the radiobutton.checked anywhere on the PageLoad, if you do, then that could be the one causing the problem, You should only assign the .checked of the Radiobutton list on the pageload within the IF ( Not Page.IsPostBack ) block, if anywhere else it will cause that problem.

 Good Luck 


Utomo IT Family
0
mutomo
5/4/2009 3:40:23 PM

mutomo, I don't set anything in the PageLoad

0
SteveAtSLC
5/4/2009 3:49:29 PM

Could you provide me with the Radiobuttonlist control tag, Onselectedindexchanged event, and pageload event please?


Utomo IT Family
0
mutomo
5/4/2009 3:53:00 PM

please post your onSelectedIndexChanged code in code behind.  a possible reason is in the event handler


Lynn

Please mark replies that have helped you as answers.

http://www.sis.pitt.edu/~lberan/collegeMathTutorPittsburgh/index.html
0
lberan
5/4/2009 3:54:15 PM

 

<asp:RadioButtonList ID="Final_Review_CompleteRadioButtonList" runat="server" RepeatDirection="Horizontal" ToolTip="Final Review Status" OnPreRender="Final_Review_CompleteRadioButtonList_OnPreRender" OnSelectedIndexChanged="test" AutoPostBack="true" CssClass="bold" >
    <asp:ListItem Value="1">Complete</asp:ListItem>
    <asp:ListItem Value="0">Incomplete</asp:ListItem>
</asp:RadioButtonList>

  

 

The OnSelectedIndexChanged event 'test' is empty until I get this figured out.  I put a breakpoint in the function and the breakpoint always gets hit even if I'm causing a different event from a different control.

And the OnPreRender event just looks at a checkbox to see if its checked or not and then checks the proper radiobuttonlist button.
protected void Final_Review_CompleteRadioButtonList_OnPreRender(object sender, EventArgs e)
{
    CheckBox Final_Review_CompleteCheckBox = null;

    try
    {
        Final_Review_CompleteCheckBox = (CheckBox)resultsFormView.FindControl("Final_Review_CompleteCheckBox");

        if (Final_Review_CompleteCheckBox.Checked)
            ((RadioButtonList)sender).SelectedValue = "1";
        else
            ((RadioButtonList)sender).SelectedValue = "0";
    }
    catch (Exception ex)
    {
        Response.Write(ex.ToString());
    }
}
  

 

 

0
SteveAtSLC
5/4/2009 4:02:36 PM

you don't have an intial value for the radio button.  in your preRender funtion, you asign a selectedVaule  "1" or "0" to the radio button. 

the preRender is called every time, therefore the radio button on change is called in every post back.


Lynn

Please mark replies that have helped you as answers.

http://www.sis.pitt.edu/~lberan/collegeMathTutorPittsburgh/index.html
0
lberan
5/4/2009 4:10:38 PM

I have never used the Prerender, but for all I know, it's being called when the checkbox is being created either right before or right after the pageload. If I were you I would move your chunk of code from the Pre render to the OnSelectedIndexChanged


Utomo IT Family
0
mutomo
5/4/2009 4:12:46 PM
The issue was that the FormView's EnableViewState was set to false.  I removed that and everything seems to be working fine.  Thanks for the help
0
SteveAtSLC
5/4/2009 4:14:23 PM
Reply:

Similar Artilces:

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

No events fire on web form
My web form suddenly quit working in that none of the server controls events fire when you click on them.  Only page initialization and the page_load routine execute.  I also can't debug the app because the breakpoints never get hit when they are set on each event. Any ideas?  I hadn't changed any code when it quit working so this is really strange.  Other web forms in the project still work fine. Thanks for any advice!   Try to double check the Button Click handler.. see whether if this portion code is missing or not..I have encountered the same problem before,...

Troubleshoot Web Service; Ajax AutoComplete events do not appear to not fire; Ajax web service appears to not work. .NET
Folks, I had the situation that Ajax AutoComplete events in the web service did not fire after I copied a project out of a folder, renamed it and moved it to a server. The fix was hard to find but easy to solve. I had some web service modules in an ASMX file that provided AutoComplete entries -- i.e., after the user keys in 2 or 3 characters, the list of possible entries with those leading characters is displayed for the user to select. To solve the problem, look at the web service's directive, not the code-behind or the ASMX designer.  Do a right-mouse-click...

WEB FORMS and datasetS (do I have to repeat the file definition in every web form?)
I am working on vb.net.I have a project with 35 web forms and an access file with 18 tables.Until now I have defined the oledbadapters in every form by dragging the tables from the server explorer tool box.This is not a good idea because every time that I make a change on the database design I have to drag the new definition on 35 web forms and I have to create the datasets again. This is boring and time consuming!The question is:WHAT CAN I DO TO HAVE THE FILE DEFINITION ONLY IN ONE PLACE AND THAT EVERY WEB FORM WOULD TAKE THE DATA ADAPTERS AND DATASETS FROM THERE? how about if you write a...

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

How to add event to Web Form from the vs.net designer
 Hi there, I know that when i double click a web form I'm taking to the page_load event.  However, I want to create an unload event by I don't know how to create it from the vs.net designer.  Does anybody know how to create a page unload event from the vs.net designer? Many thanks  Page events are not exposed in the design view. If you are using VB, you should be able to use dropdowns on top of the code editor -> select Page in the left one and the designed event in the right one and editor will generate the code. Unfortunately, C# editor does not p...

.NET 1.1 Web Form
I am scratching my head trying to figure out why my events button (Lighting Bolt) is not displaying when I select buttons in Visual Studio 2003.  Has anybody had this happen before? I am tired into Visual Source Safe and wonder if that has anything to do with it?Moojjoo Õ¿Õ http://www.mmwebs.comhttp://moojjoo.blogspot.com/ Ummm>>>   That is the difference between C# and VB.NET.  VB.NET does not display the Lightning Bolt under properties in VS 2003.Moojjoo Õ¿Õ http://www.mmwebs.comhttp://moojjoo.blogspot.com/...

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

superreview cancelled: [Bug 281568] Events popuphiding/dommenubarinactive fired too late, after dialog opened from menu action : [Attachment 173821] 1) Fire & use DOMMenuInactive events as soon as we
Aaron Leventhal <aaronleventhal@moonset.net> has cancelled Aaron Leventhal <aaronleventhal@moonset.net>'s request for superreview: Bug 281568: Events popuphiding/dommenubarinactive fired too late, after dialog opened from menu action https://bugzilla.mozilla.org/show_bug.cgi?id=281568 Attachment 173821: 1) Fire & use DOMMenuInactive events as soon as we know a menu is either being hidden or destroyed 2) Use popupshown instead of popupshowing to avoid spurious MSAA menupopupstart events https://bugzilla.mozilla.org/attachment.cgi?id=173821&action=edit ...

superreview requested: [Bug 281568] Events popuphiding/dommenubarinactive fired too late, after dialog opened from menu action : [Attachment 173821] 1) Fire & use DOMMenuInactive events as soon as we
Aaron Leventhal <aaronleventhal@moonset.net> has asked neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> for superreview: Bug 281568: Events popuphiding/dommenubarinactive fired too late, after dialog opened from menu action https://bugzilla.mozilla.org/show_bug.cgi?id=281568 Attachment 173821: 1) Fire & use DOMMenuInactive events as soon as we know a menu is either being hidden or destroyed 2) Use popupshown instead of popupshowing to avoid spurious MSAA menupopupstart events https://bugzilla.mozilla.org/attachment.cgi?id=173821&action=edit ...

An OnClick event doesn't fire up when a button is clicked in a Tab Panel in a Tab Container in an AJAX Web Form
Hello Post: I would like to enclose the following code so you can analize what is going on: "> " style="vertical-align:top;"> "> "> ...

.Net Web Form & Web Service Deployment
Hi all I have written some test web services and some web form applications and deployed them to my IIS. That's fine but I now want to deploy them to my real IIS server. I have created an msi for each but the problem is I seem to only be able to deploy to the default web site. Our default web site is turned off and instead we use several other sites. Does anybody happen to if Powerbuilder 11 supports non default web sites? If not do I need to hack the msi and if so can anybody suggest a suitable tool. I have Orca but it's not very friendly. Unless of course I knew exactly w...

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

Web resources about - Every Action in FormView Fires RadioButtonList OnSelectedIndexChanged Event - asp.net.web-forms

A2ZMenu tutorial index page
A2Zmenu.Com Blog Tutorials Online Exam Ask Question Utility Fun @ Work Funda Contact Us About Us Loading Test Your Skill Q. Out of Boxing and ...

A2ZMenu utilities index page
A2Zmenu.Com Blog Tutorials Online Exam Ask Question Utility Fun @ Work Funda Contact Us About Us Loading Online Tool Title Description Rating ...

Online Exam papers index page
A2Zmenu.Com Blog Tutorials Online Exam Ask Question Utility Fun @ Work Funda Contact Us About Us Loading Test Your Skill Q. Out of Boxing and ...

A2ZMenu Experts Comment
A2ZMenu team is committed in providing solution in various technologies through blogs, tutorials, Q & A etc. Our objective is to give a knowledge ...

Funny contents index page
A2Zmenu.Com Blog Tutorials Online Exam Ask Question Utility Fun @ Work Funda Contact Us About Us Loading Topic All Category Appraisal FunnyImages ...

If we work as team it will always sound good
Thought of the day. If we work as team, it will always sound good

Resources last updated: 1/11/2016 5:29:52 AM