I'm trying to use (response.redirect) to post some product info from an (asp:repeater) to another website, but when I try to submit it, it's telling me that my variable has not been declared. The variable is an (asp:label). Here's my code. Sub Page_Transfer(Source
As Object, e As ImageClickEventArgs) Response.redirect("http://www.?????.com/search_new.asp?ItemCo=" &product_Mfg.text "&ItemNbr=" &product_SKU.text ) End Sub These are the asp labels inside of the (asp:repeater): Is it not possible to refernce an asp:label
in the Page_Transfer Click Event? And if not is there another way to accomplish this?
I''ve been reading the forums and I'm now thinking that it's not so much the labels as it is the repeater. I'm still not really sure how to code this properly. What I'm trying to do is when I click the submit button it takes the MfgName from label(product_Mfg)
and the SKU from label(product_SKU) an adds them to the response.redirect url. How do I refrence the labels inside of the repeater in response.redirect?
It is the labels: They are not form elements (also called web controls or input elements) and the data in a label is not passed in the http header with form data. Data must be in an input element: <input type=text...> <input type=radio..> <input type=checkbox..>
<input type=hidden..> and or the .net web controls that render as above: etc.
I tried replacing them with both an html input field and an asp hidden textbox. Even after the changes it is still giving me the same error. Which is that my click event, still can not find product_Mfg or product_SKU. To my understanding though the form is
not actually passing the info, but is being handled rather by the Page_Transfer click event. Is this right?? Since I'm still getting the same error though, is there something that I'm over looking with the asp:repeater. This is what I'm trying to accomplish.
1. The Repeater displays a list of three or more featured items on my home page. List includes Item name, discription, picture, and sale price. 2. The Repeater has a image submit button that when clicked starts a page_transfer function. 3. The Page_Transfer
sends which ever item was selected to a second site that handles the eCommerce. 4. The second site handles the request in this format (http://www.example.com/search_new.asp?ItemCo=??????&ItemNbr=????????) 5. ItemCo is equal to product_Mfg inside of my repeater,
and ItemNbr is = to product_SKU So all that being said how do I pull product_Mfg and product_SKU and place them inside of my Page_Transfer? The code for the transfer is listed above. Also if I can't use labels what would be the best thing to replace them with
inorder to accomplish my goals?
Use a hidden control to hold the data: <input type=hidden name=product_Mfg id=product_Mfg runat=server> If you are using the code-behind, you have to declare this in your class:
Sub Page_Transfer(Source As Object, e As ImageClickEventArgs)
Response.redirect("http://www.?????.com/search_new.asp?ItemCo="
&product_Mfg.Value "&ItemNbr=" &product_SKU.Value )
End Sub
I sorry but I don't really understand. I still have a pretty basic understanding of asp.net. I have tried using a hidden html control and it still gave me an error telling me that product_Mfg was not declared. How does it know which label to grab when there
are multiple labels inside the repeater with the same ID? Please can you give me a simpler explanation... I guess it basically needs to function like a shopping cart. Just its handing its info to another site to handle. I thank you for the help that you have
offered though.
I hope this helps. Its back to my original. Minus the normal html, and basic formatting _____________________________________________________________________________ <script runat="server"> Sub Page_Load(Source as Object, E as EventArgs) Dim MyConn as OleDbConnection
Dim MySQL as String Dim ConnString as String Dim MyCmd as New OleDbCommand Dim MyDR as OleDbDataReader Dim ThisMonth as String = DateTime.Today.Month ConnString=("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\featureditems.mdb") MySQL=("SELECT
* FROM Products WHERE AdvertisedMonth = "&ThisMonth) MyConn = New OleDbConnection(ConnString) MyCmd = New OleDbCommand(MySQL,MyConn) MyConn.Open() test.DataSource = MyCmd.ExecuteReader(system.data.CommandBehavior.CloseConnection) test.DataBind() End Sub Sub
Page_Transfer(Source As Object, e As RepeaterCommandEventArgs) If(e.CommandName = "PageTransfer")Then Response.redirect("http://www.????.com/search_new.asp?ItemCo=" &e.product_Mfg.Value "&ItemNbr=" &e.product_SKU.Value ) End If End Sub </script> _____________________________________________________________________________
Every month my home page will feature three featured items from my database, but the site that handle the eCommerce has to have the Manufacturers Code (product_Mfg) and SKU (product_SKU). It has to be passed in this format. Example: http://www.????.com/search_new.asp?ItemCo=UNV&ItemNbr=95220
UNV needs to equal (product_Mfg) ItemNbr need to equal (product_SKU)
I am at a disadvantage, because I don't have the mdb, I don't work with vb.net, and I don't know about the repeater control. However, I created a vb project, pasted your code, stripped a lot of it out, and made it essentially work, tho disconnected and without
the repeater. Hopefully you will be able to adapt from this to fix your code:
<form id="Form1" method="post" runat="server">
<input type="hidden" ID="product_SKU" runat="server" value="Test_sku" NAME="product_SKU">
<input type="hidden" ID="product_Mfg" runat="server" value="Test_mfg" NAME="product_Mfg">
</form>
<script runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
End Sub
Private Sub Page_Transfer(ByVal sender As System.Object, ByVal e As System.EventArgs)
Response.redirect("http://www.somepage.com/search_new.asp?ItemCo=" & product_Mfg.Value & "&ItemNbr=" & product_SKU.Value )
End Sub
</script>
jackiea
Participant
990 Points
200 Posts
response.redirect & asp:labels
Aug 04, 2003 04:29 PM|LINK
Page8Studios.com
Desire without dedication is simply dreaming!
jackiea
Participant
990 Points
200 Posts
Re: response.redirect & asp:labels
Aug 04, 2003 06:22 PM|LINK
Page8Studios.com
Desire without dedication is simply dreaming!
rl711
Participant
825 Points
165 Posts
Re: response.redirect & asp:labels
Aug 04, 2003 06:50 PM|LINK
jackiea
Participant
990 Points
200 Posts
Re: response.redirect & asp:labels
Aug 04, 2003 07:44 PM|LINK
Page8Studios.com
Desire without dedication is simply dreaming!
rl711
Participant
825 Points
165 Posts
Re: response.redirect & asp:labels
Aug 05, 2003 12:59 PM|LINK
rl711
Participant
825 Points
165 Posts
Re: response.redirect & asp:labels
Aug 05, 2003 01:11 PM|LINK
Sub Page_Transfer(Source As Object, e As ImageClickEventArgs) Response.redirect("http://www.?????.com/search_new.asp?ItemCo=" &product_Mfg.Value "&ItemNbr=" &product_SKU.Value ) End Subjackiea
Participant
990 Points
200 Posts
Re: response.redirect & asp:labels
Aug 05, 2003 05:08 PM|LINK
Page8Studios.com
Desire without dedication is simply dreaming!
rl711
Participant
825 Points
165 Posts
Re: response.redirect & asp:labels
Aug 05, 2003 06:33 PM|LINK
jackiea
Participant
990 Points
200 Posts
Re: response.redirect & asp:labels
Aug 05, 2003 07:16 PM|LINK
Page8Studios.com
Desire without dedication is simply dreaming!
rl711
Participant
825 Points
165 Posts
Re: response.redirect & asp:labels
Aug 05, 2003 08:31 PM|LINK
<form id="Form1" method="post" runat="server"> <input type="hidden" ID="product_SKU" runat="server" value="Test_sku" NAME="product_SKU"> <input type="hidden" ID="product_Mfg" runat="server" value="Test_mfg" NAME="product_Mfg"> </form> <script runat="server"> Sub Page_Load(Source as Object, E as EventArgs) End Sub Private Sub Page_Transfer(ByVal sender As System.Object, ByVal e As System.EventArgs) Response.redirect("http://www.somepage.com/search_new.asp?ItemCo=" & product_Mfg.Value & "&ItemNbr=" & product_SKU.Value ) End Sub </script>