problem with Request.Form("string to get").tostring

 

i have allways used request.form to pass info betwine pages with no problem. but i am using a master page, i dont know if that got anything with it to do but anyyway i dont get the string i supose to i use this code:

 

Try

text1.Text = Request.Form.("string").ToString()

Catch

text1.Text = ""

End Try

 

on the page_load.... WHAT IS THE PROBLEM !!!!! i cant find it out and i have cheked everything and everything is right


-ande--rap-***.net--ande.somee.com--
0
andreas123
9/1/2007 7:38:20 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

5 Replies
752 Views

Similar Articles

[PageSpeed] 58

Hi,

This still works, but... In asp.net page is posting back to itself instead to another page, by default. That means when you click button, for example, page goes back to server, code is execute and page is loaded again in web browser.

This allows, among other things, more "windows like"  and object oriented approach to web development.

For example you can access Text property of textbox like this:

string myString = text1.Text

If you want to use "asp approach" you can but you have to be aware that controls like textbox don't have the same name in rendered html as what you give them.

If for example you name your control text1 in html it might look something like: ctl00$cph1$text1. See?

Open source of your web page in  IE and look what is name of your control. Then change your code to it. In my case it would be:

 text1.Text = Request.Form.("ctl00$cph1$text1").ToString()


__
Please mark post as answer if it helps, if not come back and ask again!
0
millet
9/1/2007 10:26:56 PM
well i get  ctl100$txt1 and i tryed that but it dont work either
-ande--rap-***.net--ande.somee.com--
0
andreas123
9/1/2007 10:48:05 PM

hmmm this was strange it works sometimes but not allways :S


-ande--rap-***.net--ande.somee.com--
0
andreas123
9/1/2007 10:54:05 PM

although you can hardcode the generated clientid into your code, i never do that.  the clientid can change if you are restructuring your page and you might be unaware that youve just broken something.

if you are cross posting and you want to get the value from the previous page, you could try something like this

'find a control with the server id of txt1 on the previous page
'cast it as a Textbox
'read its Text property
'note: this code will throw an exception if control "txt1" is not found...
text1.Text = DirectCast(Page.PreviousPage.FindControl("txt1"), TextBox).Text
  

 


Mike Banavige
~~~~~~~~~~~~

Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/
0
mbanavige
9/1/2007 11:11:49 PM

i got it to work now bu tthanks anyway =)


-ande--rap-***.net--ande.somee.com--
0
andreas123
9/1/2007 11:22:33 PM
Reply:

Similar Artilces:

When I get .XML document with Request.Form["xml"].ToString(); it gets error.
XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Request.Form["xml"].ToString());  I want system doesn't interrupt the code execution. How can I do system doesn't give error message?  Thanks.  Error Message  A potentially dangerous Request.Form value was detected from the client (xml="...8859-9" ?><BORCELIK><Tarih>09/...").  ...

Feature Request: "Get Extensions" and "Get Themes"
I think that when you click on the "Get Extensions" or "Get Themes" links, it should open depending on your default window-opening behavior. For example, all new windows for me open up in new tabs. However, when I click the "Get" links, they always open in new windows. I can't even find an extension to do this. How hard would this be to incorporate natively? ...

Get "Mail"/"Get "News" / "Write"/"Post" buttons?
If the "Get Mail" button text changed to "Get News", and "Write" changed to "Post" when TB's in the news-reading mode, it would save me and probably others from constantly forgetting to make the change before proceeding. :-) Or is there an extension to do this which I don't know about? Thanks! Bob Bob P wrote: > If the "Get Mail" button text changed to "Get News", and "Write" > changed to "Post" when TB's in the news-reading mode, it would save me > and probably others...

"Get Mail" vs "Get All New Messages"
I have a few different email accounts set up in Thunderbird, and I'm using the unified view to view them. Recently, I noticed that the "Get Mail" button seems to only retrieve email for the first account (sometimes?). I'd like to click on that button and retrieve email for all of the accounts. I can get the behavior that I want consistently if I pull down the menu for "Get Mail" and select "Get All New Messages", but I'd prefer to get that in a single click if possible. I tried starting from scratch and recreating my profile, but I st...

VS.NET 2005 is ignoring in web.config strict="true". I get no error when I try this: Dim x As Integer = "string"
Hello,I have this in my VS.NET 2005 web.config <compilation debug="true" strict="true" explicit="true">When I do this in my vb code:Dim x As Integer = "string"I get no error. When I hit compilation I also get no error. What am I doing wrong?Thanks for helping!Regards,J. Bauer It's a bug of some sort See this response by Scott Guthriehttp://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=3c1c9898-8076-4f69-a5e2-e99573d03c6e Unfortunately we don’t have a GUI based way to configure this. L It is something we will make sure gets added back in, though, with the next...

mozilla mail composer: quoting problems
Hi, I have configured Mozilla Mail so that the composer works text-only, which means I don't edit HTML messages. Moreover, when quoting I have configured it to use ">" as the quoting sign. No problems so far. Now, when I'm writing a message and copy and paste text, now and then manually inserting a ">" Mozilla Mail doesn't recognize that as quoted text any more and when I send the message "> " gets " > ". Now the text isn't colored any more when messages are displayed in a folder. I'd like to disabl...

Getting Request.Form["control"]
I am experiencing different behaviors with Request.Form.  On one set of pages, the names of the form controls rendered in the browser are beautifully the same as in the aspx source, and when the page is Server.Transferred true to a second page, that page is able to retrieve the form controls using the names I have in the first page's source.  On another web project, the names of the form controls assume the form: ctl000$FormConetnt$TextBox.... First case, aspx source: <body onload=''><form id="form1" runat="server"><div>...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework
 Table A: COUNTRY_LOOKUP COUNTRY_ID   smallintclustered, unique, primary key located on PRIMARY    COUNTRY_ID TABLE B: COUNTRY_MODE_RULES CARRIER_ID    intMODE_RULE_TYPE_ID    intORIG_COUNTRY_ID    smallintDEST_COUNTRY_ID    smallint clustered, unique, primary key located on PRIMARY    CARRIER_ID, MODE_RULE_TYPE_ID, ORIG_COUNTRY_ID, DEST_COUNTRY_IDThere is a foreign key relationship from COUNTRY_MODE_RULES to COUNTRY_LOOKUPORIG_COUNTRY_IDREFERENCES .COUNTRY_LOOKUP (COUNTRY_ID)DEST_CO...

Trying to change the Register link to "signup" or "get started"
Can someone please tell me where to change the text for the Register link. I would rather it say "signup" or "Get Started" or something. I have spent a long time looking for a place to change this, but im stumped. Any help is appreciated You can do this by modifying the resource file for the User control.  This is how it is accomplished: Goto the menu:  Admin->Languages. Open:  Local Resources->Admin->Skins->User.ascx.  It will ask you to "You are about to create a custom localized file for this portal. Are you sure you want to overload default localized fil...

Getting value from multiselect checkboxlist with Request.Form("")
How do we get the value of multiselect checkboxlist via Request.Form. Suppose the multiselect checkbox list contains the following option: One,Two,Three,Four,Five,Six and if i select One,Three then how can i get the values One,Three via Request.Form. Any alternate way ... You use Request.Form:        For Each x As String In Request.Form            Response.Write(x + ": " + Request.Form(x) & "<br />")        Next Alternatively, you could...

How to replace string starting with "<!-- Start Here" and ending with "End Here-->" with another string?
I found a site yesterday that showed how to do this, but never saved it. For the life in me I can't seem to find it again. I'm sure its a function of some string class but I can't find it. In a much larger string I need to replace a string starting with "<!-- Start Here" and ending with "End Here-->" with another string? ThanksUsing Visual Studio 2005. Language: C# string s = "<!-- Start Here This is a test End Here-->"; s = s.Replace("<!-- Start Here ", ""); s = s.Replace(" End Here-->", "&qu...

I am getting "it is read only" error when I am trying to use " if (Request.IsAuthenticated=false) "
hi, I am trying to use, if (Request.IsAuthenticated=false) but while using it I am geting the error, CS0200: Property or indexer 'System.Web.HttpRequest.IsAuthenticated' cannot be assigned to -- it is read only Could anyone please help Digish you need to use == when doing a comparison.  a single = is an assignment if (Request.IsAuthenticated==false) Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/ Hi mbanavige,   thankyou for the above help. really saved my wo...

Whan can i do? make "string" data type convert to "window" data type, and use a "window" name to get it ancestor "window name", thanks! i use pb5
Rich, With a string window name, you can open a window of that type if you need to. You could, of course, query that window object for any attributes. Another option is to use the LibraryExport function to export the definition of the window which is specified by the string. You can then parse the resulting file to get information on the ancestor object. HTH Sanjiv. "Rich" <windows_ce@netease.com> wrote in message news:2Xsr1WW0AHA.178@forums.sybase.com... > > > ...

How to programmatically get resource when I get string like "$resources: Resource, About"? thanks
and if I add <localize runat="Server">This text will be localized</localize>  to my page, where it will go get the data? what is its format if we represet it like "$resources: Resource, About"?  that means what is its classname and resourcekey?thanks! Hello wyx2000,Do you mean the equivalent code to this expression <%$ Resources: SharedResources %>?Take a look to the ResourceManager ClassVB .Net Coder - Apologize my C# nescienceBest Regards. Yes, I know the class, but I am not sure how to get its current instance. Hel...

Web resources about - problem with Request.Form("string to get").tostring - asp.net.getting-started

Resources last updated: 12/8/2015 10:56:44 AM