p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Professional (http://p2p.wrox.com/forumdisplay.php?f=57)
-   -   Selecting a particular item in Datagrid (http://p2p.wrox.com/showthread.php?t=35545)

muskaanbajaj November 29th, 2005 02:42 AM

Selecting a particular item in Datagrid
 
Hello Friends,
I created a datagrid which has several linkbuttons on it.(on row as well as column).

Now, i want that when i click on any of the linkbutton on the page, then control shud go to the corresponding page.

I have tried to code on ItemCommand event of datagrid, and
e.Item.Itemindex gives the index of the particular row.
I am also able to find the total no. of columns, rows and items.
But to which method/property of linkbutton shud i code to pass d control to next page.

Pls let me know asap..

Thanks n Regards,
Muskaan. :)


jbenson001 November 29th, 2005 11:43 AM

Why don't you just use a HyperLink object?



muskaanbajaj November 30th, 2005 01:44 AM

But what if i use LinkButton..?


muskaanbajaj November 30th, 2005 02:02 AM

Hey,
I am using 5 Hyperlink controls for each of the 5 columns.
But how shud i retrieve the values from my first page if i want to transfer to next page.
Its like when I click on a hyperlink then it will pass the control to the page specified in "NavigateUrl" tag, but how can i retrieve the values from my first page to the next.
And all this is being done in datagrid.....

Regards,
Muskaan. :)


jbenson001 November 30th, 2005 02:06 AM

You can try to use the datagrid's ItemCommand event and use:
e.CommandName to gett he command name and do something based on your criteria


jbenson001 November 30th, 2005 02:08 AM

Are you using querysting values in the URL? what exactly do you want to pass to the next page?


muskaanbajaj November 30th, 2005 02:25 AM

I was using query string for linkbutton.
And i want to retrieve the values of comboboxes of first page to the next page after the hyperlink is clicked.



jbenson001 November 30th, 2005 10:58 AM

You have to either use sesson variables to store the values before you redirect, or you can use Server.Transfer and then grab the values from the object. I would use session variables.


muskaanbajaj December 1st, 2005 01:24 AM

Okie...
I am using hyperlink control which i have defined in HTML code design form.
There i am passing the path of the file where the control shud transfer in "NavigateUrl" tag.
But i am not able to pass the query string variables in URL.

And if u r saying to use Session variables, how do i use them as i wud be using them for the first time.
Pls guide.



jbenson001 December 1st, 2005 01:36 AM

Will the query sting variables differ for each URL? If so you can use the ItemDataBound event of the grid and contstuct the URL there and assign it to the URL.
If you want to use session variables:
session("some var:) = "some value"

Then to retrieve it on the next page
some var = session("your session var:)




All times are GMT -4. The time now is 04:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.