Accessing a textbox within another webform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to access a textbox within webform1 in webform2
How can i do that
Urls or code snippet

Thank yo
 
Hi Varun,

This answer is simple, you cannot.

There is only one webpage active at the client.

However you can store the data of course in a session.variable at the
serverside.

I constructed a simple sample in this message from a large sample, it is
absolute not complete.

Cor

\\\webform1
Session.Item("img") = ListBox1.SelectedItem.Value
Image1.ImageUrl = "WebForm2.aspx"
End Sub
///
\\\Webform2
CInt(Session.Item("img")))
End Sub
///
 
I have two webforms with me
In webform1 button click event i am opening webform2 . thers i does some processing in webform2 gets some data and closes that webform2 and come back to webform1. When i come back to webform1 i want that data to apper in the textbox of webform1

How can i do that

Thank you
 
Hi Varun,

It could be as this
I have two webforms with me.
In webform1 button click event i am opening webform2

In the load event you place (I am not sure it it is = "" or Is nothing you
have to try that)
If Session.Item("firstStart") = "" then
Session.Item("firstStart") = "Y"
Else
Mylabel.text = Session.Item("blabla")
end if

In the button event pushed by the user from webform2
You can say
Session.Item("blabla") =textbox1.text
 
My requirement something different.

In the web form2 I get the coordinates of image control then when i close 2nd webform i want to set these coordinates to the textbox1 of webform1

Thank you
 
Dear Varun

Try the following cod

Dim strCoord as strin
'Put your coordinate values in strCoord. You can also pass complex objects in Session variables. Otherwise pass the string containing the coordinates and parse it in WebForm2
Session("Coordinates") = strCoor
Navigate to WebForm2 where Page_Load then runs
Durng Page_Load run the following cod
Dim strCoord as strin
strCoord = Session("Coordinates"

Now you have the coordinates from WebForm1 in WebForm2. You can do whatever you want with it

James J
 
Back
Top