Multually Exclusive Selection in Data Grid???

S

SStory

How can I get the select link button to select one item and unselect all the
rest????

Like radio buttons?

Thanks,

Shane
 
S

Scott M.

This should work that way automatically, but you can add in the event
handler for the select command:

datagrid.selectedItemIndex = e.item.itemindex
 
S

SStory

hmm....

Well I was reading in ASP.NET Unleashed and it showed me checking in the
ItemCommand handler to see if it was selected and if so setting a color.

Is there a better way?

thanks,

Shane
 
S

Scott M.

The selected item color can be set at design-time through the property of
the selectedItem template. Changing the grid's selected item to show in
that color is about the only functionality that the grid does without any
code needed. You may want to make sure that your grid.DataBind call is only
being done on secondary page loads:

Sub Page_Load()
If Not IsPostBack()
grid.DataBind()
End If
End Sub
 
S

SStory

ok will try it.

Thanks.
Scott M. said:
The selected item color can be set at design-time through the property of
the selectedItem template. Changing the grid's selected item to show in
that color is about the only functionality that the grid does without any
code needed. You may want to make sure that your grid.DataBind call is only
being done on secondary page loads:

Sub Page_Load()
If Not IsPostBack()
grid.DataBind()
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top