0

I am using ASP.NET 2.0. I am building a table with an ImageButton in each cell.

If the user clicks on a dropdown, I do a postback and rebuild the table with a new set of ImageButtons.

When the user clicks on an ImageButton, I show the PostBackURL property in a Javascript confirm box, and it is correct.

However, when I proceed after the postback described above, the actual PostBackURL is the one from that cell before the page did the postback.

I am building each ImageButton with a unique ID on each page.

Does anyone have any ideas why the PostBackURL shown on the ImageButton click is not actually being used?

Msonic
  • 1,456
  • 15
  • 25
  • If I look at the page source, after the postback, I see the updated text in the Javascript confirm code, but the PostBackURL for the ImageButton is not changed from the initial page load, despite the control having a new, unique ID. – user1315644 Apr 05 '12 at 15:53
  • I believe I have resolved this by setting EnableViewState=False on the Table. But, I'm not sure why the PostBackURL property was retained when the control's ID was changed. So, if anyone can help answer this, I'd appreciate it. – user1315644 Apr 05 '12 at 16:32

3 Answers3

0

Use a query string to capture the image buttons id.. Depending on the query string, the required image is displayed inside the image button

eg: response.redirect("home.aspx?imgid"+ib.id);

in the home page: string a=request.querystring("imgid");

Msonic
  • 1,456
  • 15
  • 25
  • I do build a query string in the PostBackURL with the imageID, but the prior query string value (as part of the postbackURL) was sent when the image is clicked when viewstate was enabled – user1315644 Apr 05 '12 at 16:41
0

and?..or else just do this.

image button has a post back url r8 so when the user clicks on an image capture its id using jquery [$('#imagebutton').attr('id')] and just save this info in a hidden field and retreive the value using request.form["hiddenfield"]..

0

Just check the spelling used. It should be Url instead of URL. So, try using PostBackUrl instead of PostBackURL.

pragyy
  • 96
  • 7