Click here to Skip to main content
15,889,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have one image button inside datalist control.This button shows the images which are from the database and populating the datalist.
Now I want to redirect the user to a "secondpage.aspx" page based on the image_id of the image he clicks.
So basically its like Response.Redirect(Seconpage.aspx?Img_Id=100).
So I have tried,
PostBackUrl='Secondpage.aspx?ProjectId<%#DataBinder.Eval(Container.DataItem,"ProjectId") %>'<%#DataBinder.Eval(Container.DataItem,"ProjectId") %>'

It is redirecting me to Secondpage.aspx, but the querystring value is not visible.
What to do?


UPDATE from OP:

Issue resolved. Look at one of the answers below.
Posted
Updated 27-Jul-10 21:01pm
v4
Comments
Arun Jacob 28-Jul-10 2:07am    
There are some mistakes in your code. Is it typo? just have a look and correct typos.
avishekrc 28-Jul-10 2:13am    
Can you post the full correct syntax please?

Try something like this,
PostBackUrl='<%#Eval("ProjectId", "Secondpage.aspx?ProjectId={0}")%>'

or
PostBackUrl='Secondpage.aspx?ProjectId=<%#Eval("ProjectId") %>'

Above code is not tested. But you can do something similar.
 
Share this answer
 
v3
I would guess that means that you need to fix your code, which currently seems to have the %, then # and not the < to precede them.
 
Share this answer
 
Comments
avishekrc 28-Jul-10 2:12am    
Can you post the full correct syntax please?I can't post properly what I have tried..
Hi,
I have found the answer,This is what I have done:
PostBackUrl='<%#GetUrl(DataBinder.Eval(Container.DataItem, "ProjectId")) %>'
and in CodeBehind,I have written the GetUrl function as below:
C#
protected string GetUrl(object ProjectId)
{
        return string.Format("~/Default2.aspx?ProjectId={0}", ProjectId);
}

Thanks for your help anyway!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900