Monday, March 26, 2012
passing values to other page
I'm new to .net just started with 2005 and asp.net 2.0, I'm passing control
values to other page to retrieve the data from data set based on the passing
values. It works fine. But when i click any field for sorting it looses the
values of previous form i guess so.
How can i do this, what sort of techniquest people are doing for this.
And also can you suggesst couple sites to learn .net 2005 and asp.net 2.0
Your help much appreciated
ThanksGanesh see this" two page data retrieval" sample at:-
http://www.aspnet101.com/aspnet101/tutorials.aspx?id=56
To learm try seeing :-
http://www.asp.net
Hope that helps
Patrick
"Ganesh" <gsganesh@.yahoo.com> wrote in message
news:u1ssNItSGHA.4976@.TK2MSFTNGP11.phx.gbl...
> Hi there,
> I'm new to .net just started with 2005 and asp.net 2.0, I'm passing
> control values to other page to retrieve the data from data set based on
> the passing values. It works fine. But when i click any field for sorting
> it looses the values of previous form i guess so.
> How can i do this, what sort of techniquest people are doing for this.
> And also can you suggesst couple sites to learn .net 2005 and asp.net 2.0
> Your help much appreciated
> Thanks
>
That is because you are then doing a method=POST instead of a
method=GET. Get executes the first time and will retrieve the values
from the querystring. You should store them from within a
if(!Page.IsPostBack) and then retrieve them on subsequent post backs.
JP
passing values to other page
I'm new to .net just started with 2005 and asp.net 2.0, I'm passing control
values to other page to retrieve the data from data set based on the passing
values. It works fine. But when i click any field for sorting it looses the
values of previous form i guess so.
How can i do this, what sort of techniquest people are doing for this.
And also can you suggesst couple sites to learn .net 2005 and asp.net 2.0
Your help much appreciated
ThanksGanesh see this" two page data retrieval" sample at:-
http://www.aspnet101.com/aspnet101/tutorials.aspx?id=56
To learm try seeing :-
http://www.asp.net
Hope that helps
Patrick
"Ganesh" <gsganesh@.yahoo.com> wrote in message
news:u1ssNItSGHA.4976@.TK2MSFTNGP11.phx.gbl...
> Hi there,
> I'm new to .net just started with 2005 and asp.net 2.0, I'm passing
> control values to other page to retrieve the data from data set based on
> the passing values. It works fine. But when i click any field for sorting
> it looses the values of previous form i guess so.
> How can i do this, what sort of techniquest people are doing for this.
> And also can you suggesst couple sites to learn .net 2005 and asp.net 2.0
> Your help much appreciated
> Thanks
That is because you are then doing a method=POST instead of a
method=GET. Get executes the first time and will retrieve the values
from the querystring. You should store them from within a
if(!Page.IsPostBack) and then retrieve them on subsequent post backs.
JP
Saturday, March 24, 2012
passing variable value to method in .cs
errormessage and retrieve it in my method QWE()
It doesnt work. What am I doing wrong?
public class AppLogic
{
string errormessage ="We are sorry, DB Error try again later";public static void QWE()
{
HttpContext.Current.Response.Write("<script type=text/javascript language=javascript>alert('" + errormessage +"');</script>");
}
}
Mate, How can we help you if you dont tell us what error message you get?
Try this though...
public string errormessage = errormessage ="We are sorry, DB Error try again later";
CS0120: An object reference is required for the nonstatic field, method, or property 'AppLogic.errormessage'
public class AppLogic
{
publicstaticstring errormessage ="We are sorry, DB Error try again later";public static void QWE()
{
HttpContext.Current.Response.Write("<script type=text/javascript language=javascript>alert('" +
AppLogic.errormessage +"');</script>");
}
}static method can only manipulate static field.
lovely it works :)
thank you
Best to use getters and setters when passing information in vairable about your system.
//Delcare the variable as private.
#region Declerations
private
staticstring fromAddress =string.Empty;#endregion
//Delcare the getters and setters as public
#region Properties
publicstaticstring FromAddress {get {return fromAddress; }set { fromAddress =value; } }#endregion
Passing Variable" into ASP project using VB
If I put a variable in the URL such as
http://mysite/myapp.aspx?variable=123
how do I retrieve the variable from my asp code so that I can use that value
to determine what I send on my page?
Thanks,
LarryRequest.QueryString("variable")
"Larry" <Larry@.NoMail.com> wrote in message
news:QCrCb.34269$8y1.142610@.attbi_s52...
> Very new at ASP in dotnet.
> If I put a variable in the URL such as
> http://mysite/myapp.aspx?variable=123
> how do I retrieve the variable from my asp code so that I can use that
value
> to determine what I send on my page?
> Thanks,
> Larry
That did it. Thank you so much!!!
"alien2_51" <dan.billow"at"n.o.s.p.a.m.monacocoach.commercialversion> wrote
in message news:upm3lPQwDHA.2316@.TK2MSFTNGP10.phx.gbl...
> Request.QueryString("variable")
> "Larry" <Larry@.NoMail.com> wrote in message
> news:QCrCb.34269$8y1.142610@.attbi_s52...
> > Very new at ASP in dotnet.
> > If I put a variable in the URL such as
> > http://mysite/myapp.aspx?variable=123
> > how do I retrieve the variable from my asp code so that I can use that
> value
> > to determine what I send on my page?
> > Thanks,
> > Larry
Hi Larry,
Put this in the codebehind file of your ASP.NET page:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim intVar As Integer
intVar = Request("variable")
Response.Write("You got: " & intVar.ToString)
End Sub
"Larry" <Larry@.NoMail.com> wrote in message
news:QCrCb.34269$8y1.142610@.attbi_s52...
> Very new at ASP in dotnet.
> If I put a variable in the URL such as
> http://mysite/myapp.aspx?variable=123
> how do I retrieve the variable from my asp code so that I can use that
value
> to determine what I send on my page?
> Thanks,
> Larry
passing variable value to method in .cs
errormessage and retrieve it in my method QWE()
It doesnt work. What am I doing wrong?
public class AppLogic{string errormessage ="We are sorry, DB Error try again later";public static void QWE() { HttpContext.Current.Response.Write("<script type=text/javascript language=javascript>alert('" + errormessage +"');</script>"); }}Can you give an example of the return? What is the result/output of running this?
I would like to set
errormessagestring errormessage ="We are sorry, DB Error try again later";
and retrieve it in my method QWE()('" + errormessage +"')
It doesnt work. What am I doing wrong?
public class AppLogic
{
string errormessage ="We are sorry, DB Error try again later";public static void QWE()
{
HttpContext.Current.Response.Write("<script type=text/javascript language=javascript>alert('" + errormessage +"');</script>");
}
Passing variables between sub procedures
I have used the folloiwng code to retrieve a variable value from a sending aspx page in the recieveing aspx page within the Sub Page_Load procedure:
Dim UsernameRecd as String
UsernameRecd = Context.Items("Username")
Which works fine.
However within the recieving aspx page l have another sub procedure based upon a click event on a button web control which also needs the above variable value but l cannot seem to retian the above value once the user clicks the button.
Is there a way to retrieve the variable value agian or do l have to store (and retrieve) the value once the page loads?
Help.
Parm.Store (and retrieve) the value
MajorCats