Pass Paramter from Repeater - Can't Figure This Out

R

Ranginald

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="sculpture2.aspx?catDesc=<%#DataBinder.Eval(Container.DataItem,
"catID")%>"
<img 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.
 
O

Onwuka Emeka

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>
 
R

Ranginald

Thanks for your response. How would I then pull the value?
Still with respons.querystring?

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top