Saturday, March 24, 2012
Pass variables value between diferent pages
How can I pass the values of some variables from page1.aspx to page2.aspx?
I try to define some variables in page2 and then when I click a button in
page1 it will fill that variables (in page2) with values. The proble is that
when I call page2 variable values are NULL.
Like this:
----------BEGIN
CODE---------------
Imports AppName.ClassNamePage2
Dim m_Page2 as New ClassNamePage2
Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick
//This values are in a DataSet and are correct (I debug them)
m_Page2.m_lIdHrq = CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level"))
m_Page2.m_strFnc = CStr(ds.Tables("Dados").Rows(0).Item("Name"))
//this value it is given from a dropdownlist (I check it, and it returns
the right value)
m_Page2.m_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())
Response.Redirect("Page2.aspx")
//When opens page2.aspx the values are NULL
End Sub
----------END
CODE---------------
How can I solve this?
--
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucaSince you are redirecting then the easiest way is to send them as parameters
(Querystrings)
response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq &"&m_lNivelHrq="&
m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)
or you can use Session variables.
regards,
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ruuca@.iol.pt> wrote in message
news:OXzXtNF$DHA.2808@.TK2MSFTNGP10.phx.gbl...
> Hi,
> How can I pass the values of some variables from page1.aspx to page2.aspx?
> I try to define some variables in page2 and then when I click a button in
> page1 it will fill that variables (in page2) with values. The proble is
that
> when I call page2 variable values are NULL.
> Like this:
> ----------BEGIN
> CODE---------------
> Imports AppName.ClassNamePage2
> Dim m_Page2 as New ClassNamePage2
> Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.ServerClick
> //This values are in a DataSet and are correct (I debug them)
> m_Page2.m_lIdHrq = CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
> m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level"))
> m_Page2.m_strFnc = CStr(ds.Tables("Dados").Rows(0).Item("Name"))
> //this value it is given from a dropdownlist (I check it, and it
returns
> the right value)
> m_Page2.m_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())
> Response.Redirect("Page2.aspx")
> //When opens page2.aspx the values are NULL
> End Sub
> ----------END
> CODE---------------
> How can I solve this?
>
> --
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
I like it more of your second option. Can you give me an example of that. I
presume that I have to set this variables in my GlobaAsa file, right?
--
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"Sarmad Aljazrawi" <anonymous[shylme]@.discussions.microsoft.com> escreveu na
mensagem news:eH9fe0F$DHA.1732@.TK2MSFTNGP12.phx.gbl...
> Since you are redirecting then the easiest way is to send them as
parameters
> (Querystrings)
> response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq
&"&m_lNivelHrq="&
> m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)
> or you can use Session variables.
> regards,
> --
> Sarmad Aljazrawi
> B.Sc. Computer Science, MSDBA, MCP
> www.aljazrawi.net
>
> "ruca" <ruuca@.iol.pt> wrote in message
> news:OXzXtNF$DHA.2808@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> > How can I pass the values of some variables from page1.aspx to
page2.aspx?
> > I try to define some variables in page2 and then when I click a button
in
> > page1 it will fill that variables (in page2) with values. The proble is
> that
> > when I call page2 variable values are NULL.
> > Like this:
> > ----------BEGIN
> > CODE---------------
> > Imports AppName.ClassNamePage2
> > Dim m_Page2 as New ClassNamePage2
> > Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e
As
> > System.EventArgs) Handles Button1.ServerClick
> > //This values are in a DataSet and are correct (I debug them)
> > m_Page2.m_lIdHrq = CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
> > m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level"))
> > m_Page2.m_strFnc = CStr(ds.Tables("Dados").Rows(0).Item("Name"))
> > //this value it is given from a dropdownlist (I check it, and it
> returns
> > the right value)
> > m_Page2.m_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())
> > Response.Redirect("Page2.aspx")
> > //When opens page2.aspx the values are NULL
> > End Sub
> > ----------END
> > CODE---------------
> > How can I solve this?
> > --
> > Thank's (if you try to help me)
> > Hope this help you (if I try to help you)
> > ruca
unless you want to store the variables on an sql server or work cookieless
you don't have to do anithing special
session.add("VarName",Value)
value = session.item("VarName")
hope it helps
eric
"ruca" <ruuca@.iol.pt> wrote in message
news:O9ycx6F$DHA.2576@.tk2msftngp13.phx.gbl...
> I like it more of your second option. Can you give me an example of that.
I
> presume that I have to set this variables in my GlobaAsa file, right?
>
> --
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
> "Sarmad Aljazrawi" <anonymous[shylme]@.discussions.microsoft.com> escreveu
na
> mensagem news:eH9fe0F$DHA.1732@.TK2MSFTNGP12.phx.gbl...
> > Since you are redirecting then the easiest way is to send them as
> parameters
> > (Querystrings)
> > response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq
> &"&m_lNivelHrq="&
> > m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)
> > or you can use Session variables.
> > regards,
> > --
> > Sarmad Aljazrawi
> > B.Sc. Computer Science, MSDBA, MCP
> > www.aljazrawi.net
> > "ruca" <ruuca@.iol.pt> wrote in message
> > news:OXzXtNF$DHA.2808@.TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > > How can I pass the values of some variables from page1.aspx to
> page2.aspx?
> > > I try to define some variables in page2 and then when I click a button
> in
> > > page1 it will fill that variables (in page2) with values. The proble
is
> > that
> > > when I call page2 variable values are NULL.
> > > > Like this:
> > > > ----------BEGIN
> > > CODE---------------
> > > > Imports AppName.ClassNamePage2
> > > > Dim m_Page2 as New ClassNamePage2
> > > > Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e
> As
> > > System.EventArgs) Handles Button1.ServerClick
> > > > //This values are in a DataSet and are correct (I debug them)
> > > > m_Page2.m_lIdHrq =
CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
> > > m_Page2.m_lNivelHrq =
CLng(ds.Tables("Dados").Rows(0).Item("Level"))
> > > m_Page2.m_strFnc = CStr(ds.Tables("Dados").Rows(0).Item("Name"))
> > > > //this value it is given from a dropdownlist (I check it, and it
> > returns
> > > the right value)
> > > m_Page2.m_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())
> > > > Response.Redirect("Page2.aspx")
> > > > //When opens page2.aspx the values are NULL
> > > > End Sub
> > > ----------END
> > > CODE---------------
> > > > How can I solve this?
> > > > > --
> > > > Thank's (if you try to help me)
> > > Hope this help you (if I try to help you)
> > > ruca
> >
No you don't need to set it up in global.asa you can set it any place in the
application.
session("myvar") = value
value = session("myvar")
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ruuca@.iol.pt> wrote in message
news:O9ycx6F$DHA.2576@.tk2msftngp13.phx.gbl...
> I like it more of your second option. Can you give me an example of that.
I
> presume that I have to set this variables in my GlobaAsa file, right?
>
> --
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
> "Sarmad Aljazrawi" <anonymous[shylme]@.discussions.microsoft.com> escreveu
na
> mensagem news:eH9fe0F$DHA.1732@.TK2MSFTNGP12.phx.gbl...
> > Since you are redirecting then the easiest way is to send them as
> parameters
> > (Querystrings)
> > response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq
> &"&m_lNivelHrq="&
> > m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)
> > or you can use Session variables.
> > regards,
> > --
> > Sarmad Aljazrawi
> > B.Sc. Computer Science, MSDBA, MCP
> > www.aljazrawi.net
> > "ruca" <ruuca@.iol.pt> wrote in message
> > news:OXzXtNF$DHA.2808@.TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > > How can I pass the values of some variables from page1.aspx to
> page2.aspx?
> > > I try to define some variables in page2 and then when I click a button
> in
> > > page1 it will fill that variables (in page2) with values. The proble
is
> > that
> > > when I call page2 variable values are NULL.
> > > > Like this:
> > > > ----------BEGIN
> > > CODE---------------
> > > > Imports AppName.ClassNamePage2
> > > > Dim m_Page2 as New ClassNamePage2
> > > > Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e
> As
> > > System.EventArgs) Handles Button1.ServerClick
> > > > //This values are in a DataSet and are correct (I debug them)
> > > > m_Page2.m_lIdHrq =
CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
> > > m_Page2.m_lNivelHrq =
CLng(ds.Tables("Dados").Rows(0).Item("Level"))
> > > m_Page2.m_strFnc = CStr(ds.Tables("Dados").Rows(0).Item("Name"))
> > > > //this value it is given from a dropdownlist (I check it, and it
> > returns
> > > the right value)
> > > m_Page2.m_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())
> > > > Response.Redirect("Page2.aspx")
> > > > //When opens page2.aspx the values are NULL
> > > > End Sub
> > > ----------END
> > > CODE---------------
> > > > How can I solve this?
> > > > > --
> > > > Thank's (if you try to help me)
> > > Hope this help you (if I try to help you)
> > > ruca
> >
Wednesday, March 21, 2012
passing a label value from webform(.aspx) page to a vb6 form
I have a vb6 form which has a label on it. When they click on that label it
will display the new web form and ask them to fill details. Once they fill
details it will give confirmation number. Can i pass this confirmation numbe
r
back to windows form and display it using Message box?
please let me know
Thanks,
Sridhar.You can save the confirmation number to the database from the webform and
then have the VB6 Windows application query the database record for this
confirmation number then display it.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Sridhar" wrote:
> Hi,
> I have a vb6 form which has a label on it. When they click on that label
it
> will display the new web form and ask them to fill details. Once they fill
> details it will give confirmation number. Can i pass this confirmation num
ber
> back to windows form and display it using Message box?
> please let me know
> Thanks,
> Sridhar.
Hi,
I cannot do that because the database resides on the server. we install
this vb6 application on the client's computer and it does not have access to
the database.
Thanks,
Sridhar.
"Phillip Williams" wrote:
> You can save the confirmation number to the database from the webform and
> then have the VB6 Windows application query the database record for this
> confirmation number then display it.
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Sridhar" wrote:
>
The VB6 app is launching a web page that is also on the server, correct? Tha
t
means the page gets processed server side and thus it can indeed access the
database if the proper connection string is supplied to it (suggested to
store the con string in the web.config file).
-Demetri
"Sridhar" wrote:
> Hi,
> I cannot do that because the database resides on the server. we install
> this vb6 application on the client's computer and it does not have access
to
> the database.
> Thanks,
> Sridhar.
> "Phillip Williams" wrote:
>
Never mind my last post, I was interpreting something else. Anyway, you can
have the vb6 app execute and parse the response of another web page who's
sole job is to get the new confirmation number and write it out for the vb6
app to parse.
Another solution would be the soap tool kit in the vb6 app and execute a web
service that returns the confirmation in xml.
Hope that gives you some ideas.
-Demetri
"Sridhar" wrote:
> Hi,
> I cannot do that because the database resides on the server. we install
> this vb6 application on the client's computer and it does not have access
to
> the database.
> Thanks,
> Sridhar.
> "Phillip Williams" wrote:
>
Passing a Querry string in a Response.Redirect?
I want to be able to redirect on a Button click event with a querry string attached with the username, is this possible?
would it look something like?
'Response.Redirect("link.aspx?UserId="Label.Text"") or
'Response.Redirect("link.aspx?userid=("Label.Text"))
Response.Redirect( "link.aspx?UserId=" & Server.UrlEncode(myLabel.Text) )
passing a string to a confirmation page
I have a page where a user enters some basic info (name, email address, etc.), then they click Submit.
I then display a confirmation page. I want to display text that says something like "Thanks Dave, we got your info".
In the info form page, I'm doing this when Submit is clicked:
Sub ConfirmMsg()
Dim name As String
name = txName.Text
Response.Redirect("free_cvi_confirm.aspx?name")
End Sub
Here is the Page_Load function on the confirmation page:
Private Sub Page_Load(ByVal .....)
Label1.Text = "Thanks " + Request.QueryString("name") + ", we got your info"
End Sub
This displays nothing when Label1 displays. And when I look in Request.QueryString, I also can't find the name value.
What am I doing wrong? I've tried a few different variations, but can't seem to hit it. Thanks in advance for your great help.
DaveHello, in the page where u submit the form the conform message page should be like this:
Protected Sub ConfirmMsg(ByVal sender As Object, ByVal e As EventArgs)
Dim name As String = String.Empty
name = txName.Text
Response.Redirect("free_cvi_confirm.aspx?name=" + name)
End Sub
In the second page:
Protected Sub Page_Load(ByVal src As Object, ByVal e As EventArgs)
Label1.Text = "Thanks " + Request.QueryString("name").ToString() + ", we got your info"
End Sub
Good Luck.
HI davehunt,
Welcome the asp.net forums...
Use this
Response.Redirect("free_cvi_confirm.aspx?name=" & name)
thatz it
I believe that the 2 methods suggested so far place the values of the variables in the querystring (and then retrieve the values from the querystring). If having the variables visible in the querystring is acceptable, then I don't see any reason not to use those methods.
However, if you want to "post" the variables instead use this...
In the first page:
<script runat="server">
Sub Submit(Sender as Object, e as EventArgs)
Server.Transfer("http://path/page2.aspx")
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox ID="tbName" Runat="server" />
<br>
<asp:Button Text="Submit" Runat="server" OnClick="Submit" />
</form>
</body>
</html
In the second page:
<script runat="server">
Sub Page_Load(Sender as Object, e as EventArgs)
lblName.Text = Request.Form("tbName")
End Sub
</script>
<html>
<body>
<form runat="server">
Name =
<asp:Label id="lblName" Runat="server" />
</form>
</body>
</html
Hope this helps,
Rob
Thanks guys, this was a big help.
Dave
Friday, March 16, 2012
passing a variable to frame from a datagrid...
what i want to do is when i click on an item on a datagrid,the selected item would be sent to other frame.
I use javascript to send data to other frame. But problem is when i select item, first javascript called and then method called. Do you know how to call method first and then javascript function..or do you have any idea to do same thing?
Thank you very much!are you dnamically loading a new page in the frame?
if so, pass parameters in the url like "page.aspx?param=value"
then in the page, look at the Request.Params property to get the values.
or set a session variable in the main page, and read it out in the frame page
No, the page in the frame is not dynamically loading.
Do you know how to refresh a page in a frame from other frame?
thanks