Showing posts with label querystring. Show all posts
Showing posts with label querystring. Show all posts

Thursday, March 29, 2012

Pass message

Dear,

Please let me know about querystring or howevery u know.Im tyring to pass one message one aspx page to second aspx page how can i make sentence.plz write down for me with example

This may help:

http://msdn.microsoft.com/msdnmag/issues/07/03/CuttingEdge/default.aspx?loc=en
http://www.codeproject.com/aspnet/QueryString.asp
http://www.eggheadcafe.com/articles/20060427.asp

I hope it helps. Regards,


Check below my blog post

Ways to pass data between webforms

HC

Pass multiple parameters into pages querystring property from jscript

This is a basic question but I cant seem to find the answer anywhere and
have never tried it before.

Here's one of many syntax I'm trying, but should at least show you what I'm
trying to do:

parent.data.frameElement.src="data.aspx?Task=CartAddNew & sku=" + ItemSku;

where there's 2 parameters, Task and sku, and I'm trying to pass a text
value of "CartAddNew" to the Task parameter and a value from the ItemSku
variable to the sku parameter.

Thanks.

--
moondaddy@dotnet.itags.org.nospam.comI found the answer in another posting when I searched on "Pass"

The correct way to separate the 2 parameters and their value assignments is
with a & and no spaces on each side. I had tried it with a space on each
side which made it fail. Here's what worked for me:

parent.data.frameElement.src="data.aspx?Task=CartAddNew&sku=" + sku;

refer to my post below for clarification on the value assignments.

--
moondaddy@.nospam.com
"moondaddy" <moondaddy@.nospam.com> wrote in message
news:%23C96wii$DHA.3960@.TK2MSFTNGP10.phx.gbl...
> This is a basic question but I cant seem to find the answer anywhere and
> have never tried it before.
> Here's one of many syntax I'm trying, but should at least show you what
I'm
> trying to do:
> parent.data.frameElement.src="data.aspx?Task=CartAddNew & sku=" + ItemSku;
> where there's 2 parameters, Task and sku, and I'm trying to pass a text
> value of "CartAddNew" to the Task parameter and a value from the ItemSku
> variable to the sku parameter.
> Thanks.
> --
> moondaddy@.nospam.com

pass Selected Date in as a querystring

We are trying to pass the selected date from the .net calendar in a
querystring.response.redirect("http://MyUrl?date=" & Calendar1.SelectDate)

"Chanaka" <iwebprogram@.gmail.com> wrote in message
news:%23sgvzaSjFHA.2444@.tk2msftngp13.phx.gbl...
> We are trying to pass the selected date from the .net calendar in a
> querystring.

Monday, March 26, 2012

Pass the selected date from a calendar in a querystring - .net 2005 b2

We are trying to pass the selected date from a .net calendar in a
querystring. We manage to display the selected date from the calendar in a
Lable like this :

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
lblDate.Text = Calendar1.SelectedDate.ToShortDateString();
}

<asp:Label ID="lblDate" runat="server"></asp:Label
What we are trying to accomplish is to pull the above value of the lable
which is "lblDate" to the following link and pass is as a querystring

<a href='default5.aspx?tech=<%# Eval("RESPONS")
%>&today=selected_date'><span style="font-size: 10px">Link
Name</span></a><br /
thnxprotected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
lblDate.Text = Calendar1.SelectedDate.ToShortDateString();
litDate.Text = Calendar1.SelectedDate.ToShortDateString();

}

<asp:Label ID="lblDate" runat="server"></asp:Label>
<a href='default5.aspx?tech=<asp:Literal ID="litDate"
runat="server"/>amp;today=selected_date'><span style="font-size: 10px">Link
Name</span></a><br /
Or just use HyperLink WebControl and fill NavigateUrl property with correct
data.

--
C# Dev

"Chanaka" wrote:

> We are trying to pass the selected date from a .net calendar in a
> querystring. We manage to display the selected date from the calendar in a
> Lable like this :
> protected void Calendar1_SelectionChanged(object sender, EventArgs e)
> {
> lblDate.Text = Calendar1.SelectedDate.ToShortDateString();
> }
> <asp:Label ID="lblDate" runat="server"></asp:Label>
> What we are trying to accomplish is to pull the above value of the lable
> which is "lblDate" to the following link and pass is as a querystring
> <a href='default5.aspx?tech=<%# Eval("RESPONS")
> %>&today=selected_date'><span style="font-size: 10px">Link
> Name</span></a><br />
> thnx
>
>
>

Pass two values in querystring

I am trying to pass two values in a querystring. I have no problem passing one but when I try to pass two the second doesn't work.

Heres an example of what I'm doing:

Response.Redirect(passingpage.aspx&value={0}&value2=" & txtvalue2.Text)

The first value is from a hyperlink column of a datagrid which works fine by itself. When I try to pass the second value from a textbox, it doesn't work. I'm using visual basic.

Can anyone help?the first parameter is denoted by a ? and the subsequent ones a &

eg

http:www.costall.com/default.aspx?param1=hello&Param2=world

does this answer the question or is it a typo in the post?
I have tried that and it doesn't work. Any other suggestions?
can you post the code sample?
Hello, try this:

Dim url As String = "passingpage.aspx?value1=" & txtValue1.Text & "&value2=" & txtValue2.Text
Response.Redirect(url)

regards

pass value to image control

This is my first time to use asp.net. I just want to get an image name passed from url (by using request.querystring), and then display this image, when user click the image, I also display the mouse coordinate. But I just can not get it to work, please help. Thanks. The following is my code:

<script runat="server">
Sub getCoordinates(sender As Object, e As ImageClickEventArgs)
mess.Text="Coordinates: " & e.x & ", " & e.y
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim imagename as String = Request.QueryString("name")
Dim imagePath as String =Server.MapPath("/keller/portrait/" & imagename)
End Sub
</script>
<html>
<body>
<form runat="server">
<p>Click on the image:</p>
<asp:Image
runat="server"
ImageUrl="<%=iamgePath%>"
OnClick="getCoordinates"/>
<p><asp:label id="mess" runat="server"/></p>
</form>
</body>
</html>
Welcome to the ASP.NET Forums, lily1.

The following update to your code will correctly show the image passed in with the QueryString.

<%@. page language="VB" debug="true" %>
<html>
<head>
<title>This is main Page</title>
<script runat="server"
Sub getCoordinates(sender As Object, e As ImageClickEventArgs)
mess.Text="Coordinates: " & e.x & ", " & e.y
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim imagename as String = Request.QueryString("name")
Dim imagePath As String = Server.MapPath("/keller/portrait/" & imagename & ".gif")
MyImage.ImageUrl = imagePath
End Sub

</script>
<html>
<body>
<form runat="server">
<p>Click on the image:</p>
<asp:Image runat="server"
id="MyImage"
OnClick="getCoordinates" />
<p><asp:label id="mess" runat="server" /></p>
</form>
</body>
</html>

The only difference is that I gave the asp:Image control an ID, and used this ID in your Page_Load code to set its ImageUrl property.

For details of how to get your imagemap working, see the following tutorial:
ImageMap.NET

I hope this helps.
Thanks for your help. I tried your script, The picture can be displayed correctly now, but when i click the picture, I got javascript error, it seems that function 'getCoordinates' does not execute at server instead it tries to run at client side. Here is url of the page:http://user1046822.wx15.registeredsite.com/keller/imagecrop_coodinates.aspx?name=test.jpg . Could you please tell me what is the problem? Thanks again.
> Could you please tell me what is the problem?

You've defined the problem yourself ... that getCoordinates tries to run at the client-side, not at the server.

Please go through the article I provided above. That will explain how to send click coordinates back to your server-side code.

pass values

On my web page i'm passing in a value using request.querystring, but i need
this same value several other pages. How can I store this value and use it o
n my other pages to execute my SQL?
thxIn a session variable.
Eliyahu
"IGotYourDotNet" <IGotYourDotNet@.discussions.microsoft.com> wrote in message
news:C3EEF090-CC7C-4A13-83EF-C0D7A655B93E@.microsoft.com...
> On my web page i'm passing in a value using request.querystring, but i
need this same value several other pages. How can I store this value and use
it on my other pages to execute my SQL?
> thx
You say you're "passing in a value" - Where are you passing it from? Where
are you passing it to?
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"IGotYourDotNet" <IGotYourDotNet@.discussions.microsoft.com> wrote in message
news:C3EEF090-CC7C-4A13-83EF-C0D7A655B93E@.microsoft.com...
> On my web page i'm passing in a value using request.querystring, but i
need this same value several other pages. How can I store this value and use
it on my other pages to execute my SQL?
> thx
You can pass values between pages using a variety of methods - session
variables are common, as is using viewstate. I prefer to structure my code
really well and use properties via the refernce page directive. Theres a
small example below for you
Regards
John Timney
Microsoft Regional Director
Microsoft MVP
"IGotYourDotNet" <IGotYourDotNet@.discussions.microsoft.com> wrote in message
news:C3EEF090-CC7C-4A13-83EF-C0D7A655B93E@.microsoft.com...
> On my web page i'm passing in a value using request.querystring, but i
need this same value several other pages. How can I store this value and use
it on my other pages to execute my SQL?
> thx
PassingValuesPage.aspx
<%@. Page Language="VB" ClassName="FirstPageClass" %>
<html>
<head>
<script runat="server">
Public ReadOnly Property FirstName() As String
Get
' first is the name of a TextBox control.
Return first.Text
End Get
End Property
Public ReadOnly Property LastName() As String
Get
' last is the name of a TextBox control.
Return last.Text
End Get
End Property
Sub ButtonClicked(sender As Object, e As EventArgs)
Server.Transfer("ReceivingValuesPage.aspx")
End Sub
</script>
</head>
<body>
<form runat="server">
First Name:
<asp:TextBox id="first"
runat="server"/>
<br>
Last Name:
<asp:TextBox id="last"
runat="server"/>
<br>
<asp:Button
OnClick="ButtonClicked"
Text="Go to second page"
runat=server />
</form>
</body>
</html>
--recievingvalues.aspx
<%@. Page Language="VB" %>
<%@. Reference Page="passingValuesPage.aspx" %>
<html>
<head>
<script runat="server">
Dim fp As FirstPageClass
Sub Page_Load()
If Not IsPostBack Then
fp = CType(Context.Handler, FirstPageClass)
End If
End Sub
</script>
</head>
<body>
<form runat="server">
Hello <%=fp.FirstName%> <%=fp.LastName%>
</form>
</body>
</html>

Pass values in QueryString using VB.Net

Response.Redirect("http://localhost/WebApplication3/Forms/paymentprocessing.aspx?fname=+"

'Me.txtFirstName.Text"'", False)

how do i pass the text from a control in the querey string???

Dim myURL as string = "http://Localhost/WebApplication3/Forms/paymentprocessing.aspx?fname="

myURL = myURL & Me.txtFirstName.Text

Response.Redirect(myURL, False)

Wednesday, March 21, 2012

passing a GUID in the querystring

I need to pass a GUID into a page via the QueryString. If I do:

Dim myGUID as GUID
GUID = Request.QueryString("myGUID")

It won't run, and says that a value type of string cannot be converted to a GUID. I can't retype myGUID as a string, because I use it in a SQL Server Database call...It yells at me if try to do a query with it in there.

Am I doing something wrong? or is there just no way to pass a GUID through the querystring?

ThanksIf you pass the value on the url it will be in a string format. The following worked for me. Maybe this will help.

select * from table1 where uniqueID = cast('{5BEEAA61-394B-44F6-9AC8-A6EA5FC99490}' as uniqueidentifier)
You need to do the following:

Dim MyGuid As Guid = New Guid(Request.QueryString("myGuid"))

Passing a javascript array to a handler .ashx

I am using a handler (processImage.ashx) to display an image. The image is
displayed according to parameters passed in the querystring. The handerl is
called via some clientside javascript.
I want to send an array of unknown length to the handler. I am not sure
whether the querystring is the best place to do this. What's the best way to
send an array held in the client side javascript to the handler?
Thanks in advance,
JJyou can not post an image request, so the url is the only option other than
a
prelimary ajax call. the url is restricted to about 2k. how you encode the
array depends on the array type. the most common is a array.join('|'), with
a
matching split on the server side.
-- bruce (sqlwork.com)
"JJ" wrote:

> I am using a handler (processImage.ashx) to display an image. The image is
> displayed according to parameters passed in the querystring. The handerl i
s
> called via some clientside javascript.
> I want to send an array of unknown length to the handler. I am not sure
> whether the querystring is the best place to do this. What's the best way
to
> send an array held in the client side javascript to the handler?
> Thanks in advance,
> JJ
>
>
How would I do the prelimary ajax call?
Thanks,
JJ
"bruce barker (sqlwork.com)"
<brucebarkersqlworkcom@.discussions.microsoft.com> wrote in message
news:C8495134-FF6B-4D8B-82C1-FE5F393D6454@.microsoft.com...
> you can not post an image request, so the url is the only option other
> than a
> prelimary ajax call. the url is restricted to about 2k. how you encode the
> array depends on the array type. the most common is a array.join('|'),
> with a
> matching split on the server side.
> -- bruce (sqlwork.com)
>
> "JJ" wrote:
>
Hi JJ,
I think Bruce means you should pass the image urls(or any array parameters)
either through url querystring or through AJAX xmlhttp request. Directly
manipulate binary content of image is not quite supported in client script
and also not effecient to pass such large content frequently.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "JJ" <abc@.xyz.com>
>Subject: Re: Passing a javascript array to a handler .ashx
>Date: Tue, 20 Nov 2007 10:55:18 -0000

>How would I do the prelimary ajax call?
>Thanks,
>JJ
>"bruce barker (sqlwork.com)"
><brucebarkersqlworkcom@.discussions.microsoft.com> wrote in message
>news:C8495134-FF6B-4D8B-82C1-FE5F393D6454@.microsoft.com...
the
handerl
way
>
>

Passing a javascript array to a handler .ashx

I am using a handler (processImage.ashx) to display an image. The image is
displayed according to parameters passed in the querystring. The handerl is
called via some clientside javascript.

I want to send an array of unknown length to the handler. I am not sure
whether the querystring is the best place to do this. What's the best way to
send an array held in the client side javascript to the handler?

Thanks in advance,
JJyou can not post an image request, so the url is the only option other than a
prelimary ajax call. the url is restricted to about 2k. how you encode the
array depends on the array type. the most common is a array.join('|'), with a
matching split on the server side.

-- bruce (sqlwork.com)

"JJ" wrote:

Quote:

Originally Posted by

I am using a handler (processImage.ashx) to display an image. The image is
displayed according to parameters passed in the querystring. The handerl is
called via some clientside javascript.
>
I want to send an array of unknown length to the handler. I am not sure
whether the querystring is the best place to do this. What's the best way to
send an array held in the client side javascript to the handler?
>
Thanks in advance,
JJ
>
>
>


How would I do the prelimary ajax call?

Thanks,
JJ
"bruce barker (sqlwork.com)"
<brucebarkersqlworkcom@.discussions.microsoft.comwro te in message
news:C8495134-FF6B-4D8B-82C1-FE5F393D6454@.microsoft.com...

Quote:

Originally Posted by

you can not post an image request, so the url is the only option other
than a
prelimary ajax call. the url is restricted to about 2k. how you encode the
array depends on the array type. the most common is a array.join('|'),
with a
matching split on the server side.
>
-- bruce (sqlwork.com)
>
>
"JJ" wrote:
>

Quote:

Originally Posted by

>I am using a handler (processImage.ashx) to display an image. The image
>is
>displayed according to parameters passed in the querystring. The handerl
>is
>called via some clientside javascript.
>>
>I want to send an array of unknown length to the handler. I am not sure
>whether the querystring is the best place to do this. What's the best way
>to
>send an array held in the client side javascript to the handler?
>>
>Thanks in advance,
>JJ
>>
>>
>>


Hi JJ,

I think Bruce means you should pass the image urls(or any array parameters)
either through url querystring or through AJAX xmlhttp request. Directly
manipulate binary content of image is not quite supported in client script
and also not effecient to pass such large content frequently.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

-------

Quote:

Originally Posted by

>From: "JJ" <abc@.xyz.com>
>Subject: Re: Passing a javascript array to a handler .ashx
>Date: Tue, 20 Nov 2007 10:55:18 -0000


Quote:

Originally Posted by

>How would I do the prelimary ajax call?
>
>Thanks,
>JJ
>"bruce barker (sqlwork.com)"
><brucebarkersqlworkcom@.discussions.microsoft.comwro te in message
>news:C8495134-FF6B-4D8B-82C1-FE5F393D6454@.microsoft.com...

Quote:

Originally Posted by

>you can not post an image request, so the url is the only option other
>than a
>prelimary ajax call. the url is restricted to about 2k. how you encode


the

Quote:

Originally Posted by

Quote:

Originally Posted by

>array depends on the array type. the most common is a array.join('|'),
>with a
>matching split on the server side.
>>
>-- bruce (sqlwork.com)
>>
>>
>"JJ" wrote:
>>

Quote:

Originally Posted by

>>I am using a handler (processImage.ashx) to display an image. The image
>>is
>>displayed according to parameters passed in the querystring. The


handerl

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

>>is
>>called via some clientside javascript.
>>>
>>I want to send an array of unknown length to the handler. I am not sure
>>whether the querystring is the best place to do this. What's the best


way

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

>>to
>>send an array held in the client side javascript to the handler?
>>>
>>Thanks in advance,
>>JJ
>>>
>>>
>>>


>
>
>

passing a querystring

hey all,
i know i can do response.redirect("my.aspx?id=1")

but what if i'm doing a postback, is there something similar to querystring?

thanks,
rodcharHello,

Request.QueryString allows to read querystring parameters during a postback.
Is this what you are looking for ?

--
Patrice

"rodchar" <rodchar@.discussions.microsoft.coma crit dans le message de
news: 2ACC9430-3838-4BA9-A359-1F352434FF08@.microsoft.com...

Quote:

Originally Posted by

hey all,
i know i can do response.redirect("my.aspx?id=1")
>
but what if i'm doing a postback, is there something similar to
querystring?
>
thanks,
rodchar


Use the viewstate collection or add a HiddenField.

Friday, March 16, 2012

passing ampersand(&) in querystring

I am trying to send a clients name to another page through a querystring, but some of their names are being cut in half where there is an amp.
 server.urlencode(Container.DataItem("Username"))
I even tried to use
Server.HtmlEncode
on the front and
.replace("&","^")
on the end, but I can't get it to work.
Does anyone know how to do this?
ThanksYou need to not have the ampersand in the querything unless before the parameter name. If you were doing soemthing like first&last, either send them as two words, or put a unique character that you can do a string.replace(character, newchar)
Thanks for the reply.
The problem is when there is a & as part of their name, such asA&B Painters
Also, not all company names have more than one word in them.

I think I used string.replace(character, newchar) as above, however it did nothing. Did I use it right? I think that is the way to go if I can get it to work.
Thanks
Just to make sure we have this straight, you are doing something like thisbefore you post it to the querystring:

Dim StringVar As String = "A&B Painters"

StringVar.Replace("&", "^")
Cool!
I will try that.