Wrox Programmer Forums
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 12th, 2007, 06:16 AM
Registered User
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to kethireddy435
Default datalist itemcommand

Hi ,I have taken a datalist,in that datalist I'm displaying Images of products........The problem is Whenever I clicked on the image of pirticular item, the page should be redirected to productdetails.aspx page with the "id" of that product........
I mean I should get the "product id" in productdetails.aspx page.............

Old September 12th, 2007, 06:58 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

There are many ways to do this, however, using the itemCommand event is probably not the best approach since you have said that you want the user to click on the image and not a command button.

What I would probably do is use ImageButtons instead of Images and in the buttons CommandArgument I would place the ID of the current product. You could then create a method to handle the command event of the ImageButton and just do something like this inside the method to get the ID:

ImageButton img = (ImageButton)sender;
int iPK = Convert.ToInt32(img.CommandArgument);


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid ItemCommand not fired jigsawcube1 General .NET 0 September 13th, 2007 06:33 AM
Datalist inside datalist amit.jagtap ASP.NET 2.0 Professional 1 September 4th, 2007 05:03 AM
Datagrid ItemCommand firing twice spacky001 ASP.NET 1.0 and 1.1 Basics 1 May 16th, 2007 11:06 AM
DataList ItemCommand event problem in ASP.NET page naidukap ASP.NET 1.0 and 1.1 Professional 0 December 26th, 2005 03:26 AM
DataList in DataList acko ASP.NET 1.0 and 1.1 Professional 3 July 9th, 2004 05:18 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.