Last post Aug 31, 2008 02:50 AM by russell786
Aug 20, 2008 07:52 AM|Vivek Vashisht|LINK
Hi all, I am using the following code in Global.asax.
The problem is that on my rewritten url I can't see the image on my ImageButton ( rather it displays Submit Query) .
Moreover I ImageButton_Click Event isn't working.
HttpContext context = HttpContext.Current;
string oldpath = context.Request.Path.ToLower();
string token = "productdetails/product";
int i = oldpath.IndexOf(token);
int len = token.Length;
if (i != -1)
int j = oldpath.IndexOf(".aspx");
if (j != -1)
string pid = oldpath.Substring(i + len, j - (i + len));
string newpath = oldpath.Replace(token + pid + ".aspx", "/ProductDetails.aspx?pid=" + pid);
Aug 30, 2008 01:01 AM|irtizaur|LINK
i think you have used a relative reference path to your ImageUrl like this one,
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="yourimage.gif" />
try using root qualified referenced ImageUrl path, like
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/yourimage.gif" />
specially using the ~ sign..
Aug 30, 2008 09:45 PM|docluv|LINK
Yes, that or you will have to include the full path to the image itself. As to why your Click event is not working I have no clue. Make sure it is wired up correctly.
Aug 31, 2008 02:50 AM|russell786|LINK
read this article...