FORM values on post back

 okay... another dumb nubie question here...

 I am building a form with three dropdown controls to drill down through category, sub-category and product. I have each set to post back so that when the user selects the main category the sub-category  should be populated  based on the value of  the main control.

 
The controls (or at least the first one) are binding to a WebService class. But or some crazy reason I can't seem to access the value of the main category to supply it to the sub category WebService. However the selected value of the main category is maintained on the page after post back????

 
I've tried things like the following.

public int topCatId = Convert.ToInt32(Request.Form["tcatdd"]);

 and...

public int topCatId = Convert.ToInt32(tcatdd.SelectedValue);

 

This is my first ASP.NET application and I was able to bind the dropdown to the  WebService  class... I can't beleve I can't access the  value of  the control on  the post back page!!!

 

0
jetleg
9/18/2008 7:29:50 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

4 Replies
840 Views

Similar Articles

[PageSpeed] 20

Have you tried using Cross-Page Posting? 
Just Set PostBackUrl of the Button and on the Page that you wanted to Redirect you can do something like below: 
protected void Page_Load(object sender, EventArgs e)
{
if (Page.PreviousPage != null)
{
DropDownList SourceDLL =
(DropDownList)Page.PreviousPage.FindControl("ddListStates");
if (SourceDLL != null)
{
Response.Write(SourceDLL.SelectedValue.ToString());
}
}
}
More info below:

http://msdn.microsoft.com/en-us/library/ms178139.aspx

http://www.beansoftware.com/ASP.NET-Tutorials/Cross-Page-Posting.aspx

http://www.dotnetheaven.com/UploadFile/prathore/PostBack05032007005048AM/PostBack.aspx 

 

Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
9/18/2008 8:39:39 PM

 I haven't used cross page posting because I wanted the drill down to the product on one page. Because the category, sub cat, product selection one page is preferred.

I saw one of your replies about using ClientID of the control to get the HTML generated Control ID...but it looked like client side javascript???

Does ASP.NET change the name of the control? Surly accessing the value of the drop down after postback should be so cumbersome. 

0
jetleg
9/18/2008 9:02:22 PM

 Screen Shot

0
jetleg
9/18/2008 9:12:56 PM

jetleg-jazzman :

 I haven't used cross page posting because I wanted the drill down to the product on one page. Because the category, sub cat, product selection one page is preferred.

What do you mean? Can you please elaborate more?

jetleg-jazzman :

I saw one of your replies about using ClientID of the control to get the HTML generated Control ID...but it looked like client side javascript???

Does ASP.NET change the name of the control? Surly accessing the value of the drop down after postback should be so cumbersome.

Yes that was a JavaScript codes... The ClientID value for a Control is often used to programmatically access the HTML element rendered for a control in client-side script. For details, see

http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
9/18/2008 9:23:17 PM
Reply:

Similar Artilces:

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

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

Posting Values Form to Form Same App
Hello, all I am attempting to understand how to pass form field values to another page's form field values. I can set up the Get values, Server.Transfer and discover the values that have been passed, but my problem is setting these values to the receiving page server side controls (textboxes in this case). Any help in understanding this is appreciated. Here's a simplified source: First Page:     Has Two Fields on a form     After validating, redirect to second page   Second Page:     Has Two fields on a form     Reads...

Posting to Web Form with DropDownList from another form
I have a page with a drop down list that displays data on post back from the drop down list selected index change event. (call this form1) I need the ability to post to this page from another form (call this form2). there are about 6 options in form1. form2 will contain only 2 of these options displayed as simple hyperlinks. when the user clicks these links from form2 it needs to simply force a post back with that value from form2. id like to do this without javascript and id like to use the drop down list server control. anyone have a quick simple way to accomplish this? than...

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

getting values from a web form to windows form
Hot Requirement ..... Is there any possible of getting values from a web form to windows form ????? Yes One way i to use the WebRequest and WebResponse classes of the System.Net namespace. For example:  WebRequest request = WebRequest.Create("URL of the web page); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string content = reader.ReadLine(); ....    Reza Nassabehwww.professionalcsharp.comDon't forget to click "Mark as Answer" on the post that helped you. That way fut...

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

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

How to Pass data to pop up form, allow user to add new value, pass new value back to form to do Insert
I have a grid view that shows the user the last meter readings (hours) for several generators. The meter readings need to be added daily.  I would like the user to be able to select the meter record from the grid view and have a pop up javascript form open that would allow the user to enter a new meter reading. Then after I do validation, do an insert of the new reading to the database. Is that a reasonable way of doing what I want? If not, can you give me a suggestion as to how to do it differently. Thanks. Hi..   Instead of opening window to ente...

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

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

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

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

Web resources about - FORM values on post back - asp.net.web-forms

Values Voter Summit - Wikipedia, the free encyclopedia
The Values Voter Summit is an annual political conference for American social conservative activists and elected officials from across the United ...

Facebook Is No. 5 on Glassdoor’s Top 25 Companies for Culture & Values
Facebook placed fifth on the 2014 list of Top 25 Companies for Culture & Values from social jobs and career community Glassdoor , which was released ...

Glassdoor: Facebook rated No. 5 nationally in culture, values
Facebook has been highly-rated by its employees for culture and values , coming in at No. 5 overall nationally in a new Glassdoor report . Twitter ...

Gay Family Values (@Depfox) on Twitter
Sign in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Gay Family Values @ Depfox ...

Common Lab Values on the App Store on iTunes
Get Common Lab Values on the App Store. See screenshots and ratings, and read customer reviews.

Tony Perkins' Remarks on Election 2012 and Values Voter Summit - YouTube
FRC's Tony Perkins to Discuss Presidential Race At National Press Club's Newsmakers Event September 23, 2011 WASHINGTON, D.C. - Family Research ...

Married Life: For parents, Ramadan is a time to think about values that are passed down
I worry that my 22-month-old baby will grow up thinking Ramadan is all about the food.

Forced marriages an 'assault on values': Scott Morrison
Immigration Minister Scott Morrison says forced marriages are an "assault on Australian values" after authorities intercepted a 14-year-old girl ...

America's values on trial with Manning
Over the past 2½ years, all of which he has spent in a military prison, much has been said about Bradley Manning, but nothing has been heard ...

Migrants must follow Australian values, says Frank Lowy
... boat person who became a shopping centre billionaire, has called on migrants to honour the ''great unwritten deal'' to follow Australian values ...

Resources last updated: 2/10/2016 6:55:36 PM