Thursday, March 29, 2012
Passing Values
I have two aspx pages in a frame and in the top page[top frame] i am
creating the controls[TextBox etc..] dynamically and putting in a place
holder. I have a hyperlink in this page[top frame] to populate the data in
the bottom aspx page[bottom frame]. When the user clicks this hyperlink i
need to populate the bottom aspx page[bottom aspx page]based on the user
imputs. So i need to pass the values from the top aspx page [top frame] to
bottom aspx page[bottom frame]. how can i achieve this. Please give some
ideas...
Thanks in AdvanceSince these are just aspx pages, you should be able to the querystring, or
session variables to pass data between the 2 pages.
"Gibs" <dotnet_Gibs@.yahoo.com> wrote in message
news:uHkXScD5DHA.2412@.TK2MSFTNGP09.phx.gbl...
> Hi
> I have two aspx pages in a frame and in the top page[top frame] i am
> creating the controls[TextBox etc..] dynamically and putting in a place
> holder. I have a hyperlink in this page[top frame] to populate the data in
> the bottom aspx page[bottom frame]. When the user clicks this hyperlink i
> need to populate the bottom aspx page[bottom aspx page]based on the user
> imputs. So i need to pass the values from the top aspx page [top frame] to
> bottom aspx page[bottom frame]. how can i achieve this. Please give some
> ideas...
>
> Thanks in Advance
I am using the hyperlink only to redirect the page. more if i am doing a
postback these text box values are not visible.I am getting an error 'Object
reference not set to an instance of an object'. So i am not able to set the
session also.
"Showjumper" <shojumper@.grkjashdjkf.com> wrote in message
news:uHw0LsD5DHA.1040@.TK2MSFTNGP10.phx.gbl...
> Since these are just aspx pages, you should be able to the querystring, or
> session variables to pass data between the 2 pages.
> "Gibs" <dotnet_Gibs@.yahoo.com> wrote in message
> news:uHkXScD5DHA.2412@.TK2MSFTNGP09.phx.gbl...
> > Hi
> > I have two aspx pages in a frame and in the top page[top frame] i am
> > creating the controls[TextBox etc..] dynamically and putting in a place
> > holder. I have a hyperlink in this page[top frame] to populate the data
in
> > the bottom aspx page[bottom frame]. When the user clicks this hyperlink
i
> > need to populate the bottom aspx page[bottom aspx page]based on the
user
> > imputs. So i need to pass the values from the top aspx page [top frame]
to
> > bottom aspx page[bottom frame]. how can i achieve this. Please give some
> > ideas...
> > Thanks in Advance
> I am using the hyperlink only to redirect the page. more if i am doing a
> postback these text box values are not visible.I am getting an error
'Object
> reference not set to an instance of an object'. So i am not able to set
the
> session also.
The error probably means that you ar using a tag like <asp:Textbox
id="txtPipo"> in your aspx file but you do not declare a matching Textbox
object in your codebehind file like
Textbox txtPipo;
As for passing information, you can append all the data as name-value pairs
to the target url you pass to the redirect statement like
http:/someservername?name=pipo%20%address=woonwagen%20%o ccupation=clown
and then retrieve them through Request.QueryString as Showjumper already
suggested.
> "Showjumper" <shojumper@.grkjashdjkf.com> wrote in message
> news:uHw0LsD5DHA.1040@.TK2MSFTNGP10.phx.gbl...
> > Since these are just aspx pages, you should be able to the querystring,
or
> > session variables to pass data between the 2 pages.
> > "Gibs" <dotnet_Gibs@.yahoo.com> wrote in message
> > news:uHkXScD5DHA.2412@.TK2MSFTNGP09.phx.gbl...
> > > Hi
> > > > I have two aspx pages in a frame and in the top page[top frame] i am
> > > creating the controls[TextBox etc..] dynamically and putting in a
place
> > > holder. I have a hyperlink in this page[top frame] to populate the
data
> > > in the bottom aspx page[bottom frame]. When the user clicks this
> > > hyperlink i need to populate the bottom aspx page[bottom aspx page]
> > > based on the user imputs. So i need to pass the values from the top
> > > aspx page [top frame] to bottom aspx page[bottom frame]. how can
> > > i achieve this. Please give some ideas...
You can pass some values via client side code to a control (or hidden
control) in your other frame.
Here's some javascript code that might do the trick for you:
parent.FRAMENAME.document.form1.myhiddentextbox.va lue='test';
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Gibs" <dotnet_Gibs@.yahoo.com> wrote in message
news:uHkXScD5DHA.2412@.TK2MSFTNGP09.phx.gbl...
> Hi
> I have two aspx pages in a frame and in the top page[top frame] i am
> creating the controls[TextBox etc..] dynamically and putting in a place
> holder. I have a hyperlink in this page[top frame] to populate the data in
> the bottom aspx page[bottom frame]. When the user clicks this hyperlink i
> need to populate the bottom aspx page[bottom aspx page]based on the user
> imputs. So i need to pass the values from the top aspx page [top frame] to
> bottom aspx page[bottom frame]. how can i achieve this. Please give some
> ideas...
>
> Thanks in Advance
Passing values between forms
Hi
I'm new to asp.net and I need some help
I have three forms with some textboxes.I want to pass the values of the text
boxes of form1 and form2 to the third form
For this I'm using in the first form
System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
also a get function for returning the values of textbox
In the second form
rp1 = CType(context.Current.Handler, firstform)
RegisterHiddenField("txtpjcode", Request("txtpjcode"))
similarly for the second form
But When I run this I can't retrive any values of previous forms
From: Mani P.S
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>vrL66fQqLUe3kVkG/raHIA==</Id>Hi,
see this in MSDN
http://msdn.microsoft.com/library/d...bformspages.asp
HTH
Regards
Joyjit
"Mani P.S via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:u1OdS1pNFHA.1732@.TK2MSFTNGP14.phx.gbl...
> (Type your message here)
> Hi
> I'm new to asp.net and I need some help
> I have three forms with some textboxes.I want to pass the values of the
textboxes of form1 and form2 to the third form
> For this I'm using in the first form
> System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
> also a get function for returning the values of textbox
> In the second form
> rp1 = CType(context.Current.Handler, firstform)
> RegisterHiddenField("txtpjcode", Request("txtpjcode"))
> similarly for the second form
> But When I run this I can't retrive any values of previous forms
> --
> From: Mani P.S
> --
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
> <Id>vrL66fQqLUe3kVkG/raHIA==</Id>
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetbips.com/displayarticle.aspx?id=79
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mani P.S via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:u1OdS1pNFHA.1732@.TK2MSFTNGP14.phx.gbl...
> (Type your message here)
> Hi
> I'm new to asp.net and I need some help
> I have three forms with some textboxes.I want to pass the values of the
> textboxes of form1 and form2 to the third form
> For this I'm using in the first form
> System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
> also a get function for returning the values of textbox
> In the second form
> rp1 = CType(context.Current.Handler, firstform)
> RegisterHiddenField("txtpjcode", Request("txtpjcode"))
> similarly for the second form
> But When I run this I can't retrive any values of previous forms
> --
> From: Mani P.S
> --
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
> <Id>vrL66fQqLUe3kVkG/raHIA==</Id>
Passing values between forms
Hi
I'm new to asp.net and I need some help
I have three forms with some textboxes.I want to pass the values of the textboxes of form1 and form2 to the third form
For this I'm using in the first form
System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
also a get function for returning the values of textbox
In the second form
rp1 = CType(context.Current.Handler, firstform)
RegisterHiddenField("txtpjcode", Request("txtpjcode"))
similarly for the second form
But When I run this I can't retrive any values of previous forms
----------
From: Mani P.S
--------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>vrL66fQqLUe3kVkG/raHIA==</Id>Hi,
see this in MSDN
http://msdn.microsoft.com/library/d...bformspages.asp
HTH
Regards
Joyjit
"Mani P.S via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:u1OdS1pNFHA.1732@.TK2MSFTNGP14.phx.gbl...
> (Type your message here)
> Hi
> I'm new to asp.net and I need some help
> I have three forms with some textboxes.I want to pass the values of the
textboxes of form1 and form2 to the third form
> For this I'm using in the first form
> System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
> also a get function for returning the values of textbox
> In the second form
> rp1 = CType(context.Current.Handler, firstform)
> RegisterHiddenField("txtpjcode", Request("txtpjcode"))
> similarly for the second form
> But When I run this I can't retrive any values of previous forms
> ----------
> From: Mani P.S
> --------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
> <Id>vrL66fQqLUe3kVkG/raHIA==</Id
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetbips.com/displayarticle.aspx?id=79
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mani P.S via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:u1OdS1pNFHA.1732@.TK2MSFTNGP14.phx.gbl...
> (Type your message here)
> Hi
> I'm new to asp.net and I need some help
> I have three forms with some textboxes.I want to pass the values of the
> textboxes of form1 and form2 to the third form
> For this I'm using in the first form
> System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
> also a get function for returning the values of textbox
> In the second form
> rp1 = CType(context.Current.Handler, firstform)
> RegisterHiddenField("txtpjcode", Request("txtpjcode"))
> similarly for the second form
> But When I run this I can't retrive any values of previous forms
> ----------
> From: Mani P.S
> --------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
> <Id>vrL66fQqLUe3kVkG/raHIA==</Id
Passing values between pages
I need to move from page1 to page2 but I also need to pass a string value
between the two. Is there a way to achieve this?
Thanks
Regardsquerystring
- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik
"John" <John@.nospam.infovis.co.uk> wrote in message
news:%23iWf5$WrEHA.3988@.tk2msftngp13.phx.gbl...
> Hi
> I need to move from page1 to page2 but I also need to pass a string value
> between the two. Is there a way to achieve this?
> Thanks
> Regards
>
This was asked and answered here the other day. Here's a part of the respons
e
from Steve Orr:
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetjunkies.com/tutori...?tutorialid=600
http://www.dotnetbips.com/displayarticle.aspx?id=79
Here's one nice, simple way to pass values from one page to another:
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
"John" wrote:
> Hi
> I need to move from page1 to page2 but I also need to pass a string value
> between the two. Is there a way to achieve this?
> Thanks
> Regards
>
>
You can use a Session variable.
Xavier Pacheco
Xapware Technologies Inc
manage your projects: www.xapware.com/ActiveFocus.htm
the blog: www.xavierpacheco.com/xlog
the book: www.amazon.com/exec/obidos/ASIN/067...avierpacheco-20
Umm .. be careful when you use Session variables though - sticking
everything under the sun into session variables is not the most desirable
thing to do; from a scaleability point of view.
- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik
"Xavier Pacheco" <xavier@._nospam_xapware.com> wrote in message
news:xn0do9v4d9ymlpx00f@.msnews.microsoft.com...
> You can use a Session variable.
>
> --
> Xavier Pacheco
> Xapware Technologies Inc
> manage your projects: www.xapware.com/ActiveFocus.htm
> the blog: www.xavierpacheco.com/xlog
> the book: www.amazon.com/exec/obidos/ASIN/067...avierpacheco-20
very true indeed.
Xavier Pacheco
Xapware Technologies Inc
manage your projects: www.xapware.com/ActiveFocus.htm
the blog: www.xavierpacheco.com/xlog
the book: www.amazon.com/exec/obidos/ASIN/067...avierpacheco-20
Wednesday, March 21, 2012
passing variables to a user control
I'm new to C#, moving from ASP, and slightly
so bear with me!Basically I've got 4 pages, each of which runs the same user control (some
header information). I want to be able to change the data in the user contro
l
based on the page (everything else would be duplicated, hence the user
control).
Anyway, i thought the easiest way would be to use a variable set in the
Page_load event of the calling page. So I've got a variable defined in my
page class as..
public int pageID = 1;
However, when I try to access that from the user control, it says the
variable is not defined in the namespace. What am i missing!?!
Alternatively, I could use a URL object to get the page were on directly in
the usercontrol, but I couldnt find a URL method/property to give me just th
e
file name.
Hope all that makes sense!
Cheers
DanYou should try to put a public property on your user control. In your html
code set your property.
<uc1:UserControl id="MyControl" runat="server"
MyPublicProp="1"></uc1:UserControl>
If you want to do this from code, first, you should declare your user
control in your page because visual studion didn't do this by default.
it should look like this
protected MyPath.To.Control.ControlName MyControl;
after this you can acces your control properties normally..
MyControl.MyPublicProp ="1";
Cheers
"Dan Nash" wrote:
> Hi
> I'm new to C#, moving from ASP, and slightly
so bear with me!> Basically I've got 4 pages, each of which runs the same user control (some
> header information). I want to be able to change the data in the user cont
rol
> based on the page (everything else would be duplicated, hence the user
> control).
> Anyway, i thought the easiest way would be to use a variable set in the
> Page_load event of the calling page. So I've got a variable defined in my
> page class as..
> public int pageID = 1;
> However, when I try to access that from the user control, it says the
> variable is not defined in the namespace. What am i missing!?!
> Alternatively, I could use a URL object to get the page were on directly i
n
> the usercontrol, but I couldnt find a URL method/property to give me just
the
> file name.
> Hope all that makes sense!
> Cheers
>
> Dan
>
Hi,
Create an interface. eg:
public interface ICommonPage
{
int PageID{get;}
}
then implement it in the classes that contain the usercontrol in question
like this:
public class page1 : System.Web.UI.Page, ICommonPage
{
//Hardcode the value in a field:
int _PageID = 1; // or 2 in page2, 3 in page3, etc.
// The actual implementation:
public ICommonPage.PageID
{
get{return _PageID;}
}
// the rest of the class as it is...
}
And finally in the usercontrol cast the Page property to the interface and
get the value:
int PageID = ((ICommonPage)Page).PageID;
// work with PageID...
Hope this helps
Martin
"Dan Nash" <dan@.musoswire.co.uk> wrote in message
news:1D302C45-765A-46AE-AB82-631BB104CB6A@.microsoft.com...
> Hi
> I'm new to C#, moving from ASP, and slightly
so bear with me!> Basically I've got 4 pages, each of which runs the same user control (some
> header information). I want to be able to change the data in the user
control
> based on the page (everything else would be duplicated, hence the user
> control).
> Anyway, i thought the easiest way would be to use a variable set in the
> Page_load event of the calling page. So I've got a variable defined in my
> page class as..
> public int pageID = 1;
> However, when I try to access that from the user control, it says the
> variable is not defined in the namespace. What am i missing!?!
> Alternatively, I could use a URL object to get the page were on directly
in
> the usercontrol, but I couldnt find a URL method/property to give me just
the
> file name.
> Hope all that makes sense!
> Cheers
>
> Dan
>
Thanks guys!
Psychos post solved it, I guess you would say, the easy way! However,
Martin's solution looks interesting.. might try that one when I know a bit
more about C# (only got it Friday!).
Would there be any advantage with ICommonPage over the second method that
Psycho suggested?
Cheers guys
Dan
"Dan Nash" wrote:
> Hi
> I'm new to C#, moving from ASP, and slightly
so bear with me!> Basically I've got 4 pages, each of which runs the same user control (some
> header information). I want to be able to change the data in the user cont
rol
> based on the page (everything else would be duplicated, hence the user
> control).
> Anyway, i thought the easiest way would be to use a variable set in the
> Page_load event of the calling page. So I've got a variable defined in my
> page class as..
> public int pageID = 1;
> However, when I try to access that from the user control, it says the
> variable is not defined in the namespace. What am i missing!?!
> Alternatively, I could use a URL object to get the page were on directly i
n
> the usercontrol, but I couldnt find a URL method/property to give me just
the
> file name.
> Hope all that makes sense!
> Cheers
>
> Dan
>
passing variables to a user control
I'm new to C#, moving from ASP, and slightly confused so bear with me!
Basically I've got 4 pages, each of which runs the same user control (some
header information). I want to be able to change the data in the user control
based on the page (everything else would be duplicated, hence the user
control).
Anyway, i thought the easiest way would be to use a variable set in the
Page_load event of the calling page. So I've got a variable defined in my
page class as..
public int pageID = 1;
However, when I try to access that from the user control, it says the
variable is not defined in the namespace. What am i missing!?!
Alternatively, I could use a URL object to get the page were on directly in
the usercontrol, but I couldnt find a URL method/property to give me just the
file name.
Hope all that makes sense!
Cheers
DanYou should try to put a public property on your user control. In your html
code set your property.
<uc1:UserControl id="MyControl" runat="server"
MyPublicProp="1"></uc1:UserControl
If you want to do this from code, first, you should declare your user
control in your page because visual studion didn't do this by default.
it should look like this
protected MyPath.To.Control.ControlName MyControl;
after this you can acces your control properties normally..
MyControl.MyPublicProp ="1";
Cheers
"Dan Nash" wrote:
> Hi
> I'm new to C#, moving from ASP, and slightly confused so bear with me!
> Basically I've got 4 pages, each of which runs the same user control (some
> header information). I want to be able to change the data in the user control
> based on the page (everything else would be duplicated, hence the user
> control).
> Anyway, i thought the easiest way would be to use a variable set in the
> Page_load event of the calling page. So I've got a variable defined in my
> page class as..
> public int pageID = 1;
> However, when I try to access that from the user control, it says the
> variable is not defined in the namespace. What am i missing!?!
> Alternatively, I could use a URL object to get the page were on directly in
> the usercontrol, but I couldnt find a URL method/property to give me just the
> file name.
> Hope all that makes sense!
> Cheers
>
> Dan
>
Hi,
Create an interface. eg:
public interface ICommonPage
{
int PageID{get;}
}
then implement it in the classes that contain the usercontrol in question
like this:
public class page1 : System.Web.UI.Page, ICommonPage
{
//Hardcode the value in a field:
int _PageID = 1; // or 2 in page2, 3 in page3, etc.
// The actual implementation:
public ICommonPage.PageID
{
get{return _PageID;}
}
// the rest of the class as it is...
}
And finally in the usercontrol cast the Page property to the interface and
get the value:
int PageID = ((ICommonPage)Page).PageID;
// work with PageID...
Hope this helps
Martin
"Dan Nash" <dan@.musoswire.co.uk> wrote in message
news:1D302C45-765A-46AE-AB82-631BB104CB6A@.microsoft.com...
> Hi
> I'm new to C#, moving from ASP, and slightly confused so bear with me!
> Basically I've got 4 pages, each of which runs the same user control (some
> header information). I want to be able to change the data in the user
control
> based on the page (everything else would be duplicated, hence the user
> control).
> Anyway, i thought the easiest way would be to use a variable set in the
> Page_load event of the calling page. So I've got a variable defined in my
> page class as..
> public int pageID = 1;
> However, when I try to access that from the user control, it says the
> variable is not defined in the namespace. What am i missing!?!
> Alternatively, I could use a URL object to get the page were on directly
in
> the usercontrol, but I couldnt find a URL method/property to give me just
the
> file name.
> Hope all that makes sense!
> Cheers
>
> Dan
Thanks guys!
Psychos post solved it, I guess you would say, the easy way! However,
Martin's solution looks interesting.. might try that one when I know a bit
more about C# (only got it Friday!).
Would there be any advantage with ICommonPage over the second method that
Psycho suggested?
Cheers guys
Dan
"Dan Nash" wrote:
> Hi
> I'm new to C#, moving from ASP, and slightly confused so bear with me!
> Basically I've got 4 pages, each of which runs the same user control (some
> header information). I want to be able to change the data in the user control
> based on the page (everything else would be duplicated, hence the user
> control).
> Anyway, i thought the easiest way would be to use a variable set in the
> Page_load event of the calling page. So I've got a variable defined in my
> page class as..
> public int pageID = 1;
> However, when I try to access that from the user control, it says the
> variable is not defined in the namespace. What am i missing!?!
> Alternatively, I could use a URL object to get the page were on directly in
> the usercontrol, but I couldnt find a URL method/property to give me just the
> file name.
> Hope all that makes sense!
> Cheers
>
> Dan
>
Friday, March 16, 2012
Password encrypt/decrypt
I'm not able to find a newsgroup for classic asp so I'm writing here hoping
someone can help me
So, I have to encrypt and also decrypt some user passwords
I know md5 algoritm is a one way method so it can't be used for decryption
Do you know about any ready-made functions (Classical ASP) to do this task?
(Encrypt and Decrypt)
ThanksThis one might be useful
http://rossm.net/Electronics/Computers/Software/ASP/
--
The best
srini
http://www.expertszone.com
"Microsoft" wrote:
> Hi
> I'm not able to find a newsgroup for classic asp so I'm writing here hopin
g
> someone can help me
> So, I have to encrypt and also decrypt some user passwords
> I know md5 algoritm is a one way method so it can't be used for decryption
> Do you know about any ready-made functions (Classical ASP) to do this task
?
> (Encrypt and Decrypt)
> Thanks
>
>
Password encrypt/decrypt
I'm not able to find a newsgroup for classic asp so I'm writing here hoping
someone can help me
So, I have to encrypt and also decrypt some user passwords
I know md5 algoritm is a one way method so it can't be used for decryption
Do you know about any ready-made functions (Classical ASP) to do this task?
(Encrypt and Decrypt)
ThanksThis one might be useful
http://rossm.net/Electronics/Computers/Software/ASP/
--
The best
srini
http://www.expertszone.com
"Microsoft" wrote:
> Hi
> I'm not able to find a newsgroup for classic asp so I'm writing here hoping
> someone can help me
> So, I have to encrypt and also decrypt some user passwords
> I know md5 algoritm is a one way method so it can't be used for decryption
> Do you know about any ready-made functions (Classical ASP) to do this task?
> (Encrypt and Decrypt)
> Thanks
>
>