Thursday, March 29, 2012
Pass multiple parameters into pages querystring property from jscript
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 Paramter from Repeater - Can't Figure This Out
I have a repeater based on a stored procedure. It pulls the following:
catDesc Image
The user sees the category description (catDesc) , and then clicks on
the image (Image) which is bound to the catID. This catID (@dotnet.itags.org.catID --
an integer) is then to be passed to the next page, sculpture2.aspx for
use in a datagrid with a stored procedure.
I understand how to pass a parameter using response.redirect. I've
done so with a dropdownlist in the past by using OnSelectedIndexChanged
and just using dropdownlist.selecteditem.value as the parameter (an
integer in this case) which I use with response.redirect.
Is there an equivalent techinque for using a repeater?
Here is my code:
<asp:repeater runat="server" ID=repeaterOdd>
<itemtemplate>
<p align="left"><%#DataBinder.Eval(Container.DataItem,
"catDesc") %></p>
<p align="left">
<a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"
<img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
</itemtemplate>
</asp:repeater>
If I pass this parameter as CatID, then I can't retrieve it using a
querysting, and the whole goal is to use a querystring to pass the
parameter. (e.g int passedValue = Request.Querystring["catID"].
Is there some way to pull the selected value of catID out of the
repeater, put it in some kind of variable, and then run a method to
attach it to a response.redirect?
Is there another way to do this? Using a LinkButton?
Thanks in advance.you can replace the image tag with an asp:HyperLink that way the user can
click on the image and be redirected to a page with your catID accesible
thus:
<asp:HyperLink id="HyperLink1" runat="server" ImageUrl="<%#
DataBinder.Eval(Container.DataItem, "image") %>"
NavigateUrl=secondpage.aspx?caiID=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"></asp:HyperLink>
"Ranginald" <davidwank@.gmail.com> wrote in message
news:1146692474.566945.201390@.y43g2000cwc.googlegroups.com...
> Hi,
> I have a repeater based on a stored procedure. It pulls the following:
> catDesc Image
> The user sees the category description (catDesc) , and then clicks on
> the image (Image) which is bound to the catID. This catID (@.catID --
> an integer) is then to be passed to the next page, sculpture2.aspx for
> use in a datagrid with a stored procedure.
> I understand how to pass a parameter using response.redirect. I've
> done so with a dropdownlist in the past by using OnSelectedIndexChanged
> and just using dropdownlist.selecteditem.value as the parameter (an
> integer in this case) which I use with response.redirect.
> Is there an equivalent techinque for using a repeater?
> Here is my code:
> <asp:repeater runat="server" ID=repeaterOdd>
> <itemtemplate>
> <p align="left"><%#DataBinder.Eval(Container.DataItem,
> "catDesc") %></p>
> <p align="left">
> <a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
> "catID")%>"
> <img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
> </itemtemplate>
> </asp:repeater>
> If I pass this parameter as CatID, then I can't retrieve it using a
> querysting, and the whole goal is to use a querystring to pass the
> parameter. (e.g int passedValue = Request.Querystring["catID"].
> Is there some way to pull the selected value of catID out of the
> repeater, put it in some kind of variable, and then run a method to
> attach it to a response.redirect?
> Is there another way to do this? Using a LinkButton?
> Thanks in advance.
>
Thanks for your response. How would I then pull the value?
Still with respons.querystring?
Thanks again.
Pass Paramter from Repeater - Cant Figure This Out
I have a repeater based on a stored procedure. It pulls the following:
catDesc Image
The user sees the category description (catDesc) , and then clicks on
the image (Image) which is bound to the catID. This catID (@dotnet.itags.org.catID --
an integer) is then to be passed to the next page, sculpture2.aspx for
use in a datagrid with a stored procedure.
I understand how to pass a parameter using response.redirect. I've
done so with a dropdownlist in the past by using OnSelectedIndexChanged
and just using dropdownlist.selecteditem.value as the parameter (an
integer in this case) which I use with response.redirect.
Is there an equivalent techinque for using a repeater?
Here is my code:
<asp:repeater runat="server" ID=repeaterOdd>
<itemtemplate>
<p align="left"><%#DataBinder.Eval(Container.DataItem,
"catDesc") %></p>
<p align="left">
<a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"
<img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
</itemtemplate>
</asp:repeater
If I pass this parameter as CatID, then I can't retrieve it using a
querysting, and the whole goal is to use a querystring to pass the
parameter. (e.g int passedValue = Request.Querystring["catID"].
Is there some way to pull the selected value of catID out of the
repeater, put it in some kind of variable, and then run a method to
attach it to a response.redirect?
Is there another way to do this? Using a LinkButton?
Thanks in advance.you can replace the image tag with an asp:HyperLink that way the user can
click on the image and be redirected to a page with your catID accesible
thus:
<asp:HyperLink id="HyperLink1" runat="server" ImageUrl="<%#
DataBinder.Eval(Container.DataItem, "image") %>"
NavigateUrl=secondpage.aspx?caiID=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"></asp:HyperLink
"Ranginald" <davidwank@.gmail.com> wrote in message
news:1146692474.566945.201390@.y43g2000cwc.googlegr oups.com...
> Hi,
> I have a repeater based on a stored procedure. It pulls the following:
> catDesc Image
> The user sees the category description (catDesc) , and then clicks on
> the image (Image) which is bound to the catID. This catID (@.catID --
> an integer) is then to be passed to the next page, sculpture2.aspx for
> use in a datagrid with a stored procedure.
> I understand how to pass a parameter using response.redirect. I've
> done so with a dropdownlist in the past by using OnSelectedIndexChanged
> and just using dropdownlist.selecteditem.value as the parameter (an
> integer in this case) which I use with response.redirect.
> Is there an equivalent techinque for using a repeater?
> Here is my code:
> <asp:repeater runat="server" ID=repeaterOdd>
> <itemtemplate>
> <p align="left"><%#DataBinder.Eval(Container.DataItem,
> "catDesc") %></p>
> <p align="left">
> <a href="http://links.10026.com/?link=sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
> "catID")%>"
> <img src="http://pics.10026.com/?src=<%# DataBinder.Eval(Container.DataItem, "image") %>"></p>
> </itemtemplate>
> </asp:repeater>
> If I pass this parameter as CatID, then I can't retrieve it using a
> querysting, and the whole goal is to use a querystring to pass the
> parameter. (e.g int passedValue = Request.Querystring["catID"].
> Is there some way to pull the selected value of catID out of the
> repeater, put it in some kind of variable, and then run a method to
> attach it to a response.redirect?
> Is there another way to do this? Using a LinkButton?
> Thanks in advance.
Thanks for your response. How would I then pull the value?
Still with respons.querystring?
Thanks again.
Friday, March 16, 2012
Passing a value to a where clause
I need the where statement of my select, to change randomly and I can't make it work.
Everything works fine as long as the Where clause is hard coded. This is the code that I'm playing with. I'm using Access. I'm not sure it makes a difference..
The randomprofileid variable is what I would like to have in place of the DefaultValue="3"
=====================================
<%
Dim randomprofileid
RANDOMIZE
randomprofileid =INT(((7)*RND())+1)
%
<FORM ID="form1" RUNAT="server">
<asp:AccessDataSource
runat="server"
id="AccessDataSource1"
DataFile="gorally.mdb"
SelectCommand="SELECT Profile_Name, Profile_Notes, Profile_Image_Small, Profiles_id FROM Profiles where (profiles_id = @dotnet.itags.org.profiles_id) "
<SelectParameters>
<asp:Parameter Name="profiles_id" DefaultValue="3" />
</SelectParameters
</asp:AccessDataSource>
=====================================
hey, this page might help you understand how it all works.
http://www.pluralsight.com/blogs/fritz/archive/2006/01/16/18054.aspx
My ASP.Net knowledge is so rudimentary that I'm all confused...
I need to pass a variable, which in this case is a random number, to the where clause.
From the code below you'll see what I need: instead of the hard coded DefaultValue="3", I would like the contents of the "randomprofileid" variable.
Off course this is in the hope that when the sql statement executes, it will use in its where clause a random profileid value
Thanks a million for your time.
=====================================
<%
Dim randomprofileid
RANDOMIZE
randomprofileid =INT(((7)*RND())+1)
%
<FORM ID="form1" RUNAT="server">
<asp:AccessDataSource
runat="server"
id="AccessDataSource1"
DataFile="gorally.mdb"
SelectCommand="SELECT Profile_Name, Profile_Notes, Profile_Image_Small, Profiles_id FROM Profiles where (profiles_id = @.profiles_id) "
<SelectParameters>
<asp:Parameter Name="profiles_id" DefaultValue="3" />
</SelectParameters
</asp:AccessDataSource>
=====================================
Anyone? Is it that hard?
I think you need to assign your random number to the select parameter in code. Try:
Dim randomprofileid
Randomize()
randomprofileid = Int(((7) * Rnd()) + 1)
AccessDataSource1.SelectParameters("profiles_id").DefaultValue = randomprofileid
Is this the layout of the code? Please see below...
If it is, it didn't work. It gives me an error:NullReferenceException: Object reference not set to an instance of an object.
==================================
<%
'randomize the record to retrieve
Dim randomprofileid
Randomize()
randomprofileid = Int(((7) * Rnd()) + 1)
AccessDataSource1.SelectParameters("profiles_id").DefaultValue = randomprofileid
%>
<FORM ID="form1" RUNAT="server">
<asp:AccessDataSource
runat="server"
id="AccessDataSource1"
DataFile="gorally.mdb"
SelectCommand="SELECT Profile_Name, Profile_Notes, Profile_Image_Small, Profiles_id FROM Profiles where (profiles_id = @.profiles_id) ">
<SelectParameters>
<asp:Parameter Name="profiles_id" />
</SelectParameters>
</asp:AccessDataSource>
....
....
</FORM>
==================================
You are referring to the datasource before it has been initiated. I use code-behind files, so I'm not sure where you need to put the inline code to make it work. But you could put your code in the 'Init' event of your datasource in the code-behind file:
Protected Sub AccessDataSource1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles AccessDataSource1.Init
Dim randomprofileid
Randomize()
randomprofileid = Int(((7) * Rnd()) + 1)
AccessDataSource1.SelectParameters("profiles_id").DefaultValue = randomprofileid
End Sub
franklopes:
I need the where statement of my select, to change randomly and I can't make it work.
Everything works fine as long as the Where clause is hard coded. This is the code that I'm playing with. I'm using Access. I'm not sure it makes a difference..
The randomprofileid variable is what I would like to have in place of the DefaultValue="3"
=====================================
<%
Dim randomprofileid
RANDOMIZE
randomprofileid =INT(((7)*RND())+1)
%><FORM ID="form1" RUNAT="server">
<asp:AccessDataSource
runat="server"
id="AccessDataSource1"
DataFile="gorally.mdb"
SelectCommand="SELECT Profile_Name, Profile_Notes, Profile_Image_Small, Profiles_id FROM Profiles where (profiles_id = @.profiles_id) "
<SelectParameters>
<asp:Parameter Name="profiles_id" DefaultValue="3" />
</SelectParameters
</asp:AccessDataSource>
=====================================
Hi Franklopes,
You can alter the Parameter value in the AccessDataSource1_Selecting method, the following is the code:
Protected Sub AccessDataSource1_Selecting(ByVal senderAs Object,ByVal eAs SqlDataSourceSelectingEventArgs)Dim intValueAs Integer = 2e.Command.Parameters("@.profiles_id").Value = intValueEnd Sub I hope this helps.