472,951 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.

Can't select a row in DataGrid control

I'm using a DataGrid control in a web form. I can display it using binding
but when I click on any of the items there is no feedback that that row has
been selected. I changed SelectedItemStyle but the changes do not appear
when a row is clicked. What do I need to do to get it to do selection?

================================================== =
Zachary Hilbun
Software Consultant http://www.vianova.com
Via Nova OpenGL, Open Inventor 3D products, Windows 95/NT
Dallas, Texas VC++, C#, embedded systems, VxD's
1977 SSII SRX31185
Glock 30
Nov 19 '05 #1
3 2320
Handle the ItemCommand event and set the SelectedIndex.

Includea button in your <ItemTemplate> section:
<ASP:Button CommandName="Select" Text="Info" runat="server" />

Add OnItemCommand="DoItemSelect" to your DataGrid and use an event handler
like this:

Sub DoItemSelect(objSource As Object, objArgs As DataGridCommandEventArgs)

'see if it was the Select button that was clicked
If objArgs.CommandName = "Select" Then

'set the SelectedIndex property of the list to this item's index
MyDataGrid.SelectedIndex = objArgs.Item.ItemIndex
BindDataGrid() 'bind the data and display it

End If

End Sub


"Zachary Hilbun" <gu****@vianova.com> wrote in message
news:sI****************@newssvr12.news.prodigy.com ...
I'm using a DataGrid control in a web form. I can display it using binding but when I click on any of the items there is no feedback that that row has been selected. I changed SelectedItemStyle but the changes do not appear
when a row is clicked. What do I need to do to get it to do selection?

================================================== =
Zachary Hilbun
Software Consultant http://www.vianova.com
Via Nova OpenGL, Open Inventor 3D products, Windows 95/NT
Dallas, Texas VC++, C#, embedded systems, VxD's
1977 SSII SRX31185
Glock 30

Nov 19 '05 #2
I've got the DataGrid working for selection but from what I can tell the
DataGrid only allows you to select 1 row at a time. Is this true? I wanted
to select several rows in some list before a postback was done. Is a
ListBox the only control I can use if I want multiple selection? Will it
require a postback for each selection?
================================================== =
Zachary Hilbun
Software Consultant http://www.vianova.com
Via Nova OpenGL, Open Inventor 3D products, Windows 95/NT
Dallas, Texas VC++, C#, embedded systems, VxD's
1977 SSII SRX31185
Glock 30

"Alex Homer" <al**@stonebroom.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Handle the ItemCommand event and set the SelectedIndex.

Includea button in your <ItemTemplate> section:
<ASP:Button CommandName="Select" Text="Info" runat="server" />

Add OnItemCommand="DoItemSelect" to your DataGrid and use an event handler
like this:

Sub DoItemSelect(objSource As Object, objArgs As DataGridCommandEventArgs)

'see if it was the Select button that was clicked
If objArgs.CommandName = "Select" Then

'set the SelectedIndex property of the list to this item's index
MyDataGrid.SelectedIndex = objArgs.Item.ItemIndex
BindDataGrid() 'bind the data and display it

End If

End Sub


"Zachary Hilbun" <gu****@vianova.com> wrote in message
news:sI****************@newssvr12.news.prodigy.com ...
I'm using a DataGrid control in a web form. I can display it using

binding
but when I click on any of the items there is no feedback that that row

has
been selected. I changed SelectedItemStyle but the changes do not appear
when a row is clicked. What do I need to do to get it to do selection?

================================================== =
Zachary Hilbun
Software Consultant http://www.vianova.com
Via Nova OpenGL, Open Inventor 3D products, Windows 95/NT
Dallas, Texas VC++, C#, embedded systems, VxD's
1977 SSII SRX31185
Glock 30


Nov 19 '05 #3
You can use checkbox in each of the row for allowing users to select that
row. To knwo how to implement this in datagrid, read this article.
http://msdn.microsoft.com/library/en...ngmultiplerows
--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Zachary Hilbun" <gu****@vianova.com> wrote in message
news:Wy*****************@newssvr12.news.prodigy.co m...
I've got the DataGrid working for selection but from what I can tell the
DataGrid only allows you to select 1 row at a time. Is this true? I wanted to select several rows in some list before a postback was done. Is a
ListBox the only control I can use if I want multiple selection? Will it
require a postback for each selection?
================================================== =
Zachary Hilbun
Software Consultant http://www.vianova.com
Via Nova OpenGL, Open Inventor 3D products, Windows 95/NT
Dallas, Texas VC++, C#, embedded systems, VxD's
1977 SSII SRX31185
Glock 30

"Alex Homer" <al**@stonebroom.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Handle the ItemCommand event and set the SelectedIndex.

Includea button in your <ItemTemplate> section:
<ASP:Button CommandName="Select" Text="Info" runat="server" />

Add OnItemCommand="DoItemSelect" to your DataGrid and use an event handler like this:

Sub DoItemSelect(objSource As Object, objArgs As DataGridCommandEventArgs)
'see if it was the Select button that was clicked
If objArgs.CommandName = "Select" Then

'set the SelectedIndex property of the list to this item's index
MyDataGrid.SelectedIndex = objArgs.Item.ItemIndex
BindDataGrid() 'bind the data and display it

End If

End Sub


"Zachary Hilbun" <gu****@vianova.com> wrote in message
news:sI****************@newssvr12.news.prodigy.com ...
I'm using a DataGrid control in a web form. I can display it using

binding
but when I click on any of the items there is no feedback that that row

has
been selected. I changed SelectedItemStyle but the changes do not appear when a row is clicked. What do I need to do to get it to do selection?

================================================== =
Zachary Hilbun
Software Consultant http://www.vianova.com
Via Nova OpenGL, Open Inventor 3D products, Windows 95/NT
Dallas, Texas VC++, C#, embedded systems, VxD's
1977 SSII SRX31185
Glock 30



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is...
2
by: Juan | last post by:
Do i have to loop trough a datagrid in order to find and select a row just being inserted in the dataset connected to the data grid? is there any event i can capture in the datagrid to obtain the...
1
by: bill yeager | last post by:
I have a datagrid control within a datalist control. When I try and do a "Find" on the control, the object comes back with nothing and then my pgm crashes. I am 100% sure that my datagird inside...
5
by: sianan | last post by:
I have an ASP.NET custom control, which contains a DataGrid with checkboxes. I am trying to figure out how to retrieve the selected records, based on the checkbox's checked state. I want to send...
5
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
2
by: abc my vclass | last post by:
I want to write a form control to lookup some tables fields from database, let users to select one record (or multi-select more records) under win-form environment for fill some fields of parent...
4
by: Server Control | last post by:
Hi, I have a datagrid(within a user control) that has label controls. I have added hidden fields in the datagrid alongwitht the label control. I do some client side editing with javascript and...
0
by: savvy | last post by:
savvy Feb 1, 4:23 pm show options Newsgroups: microsoft.public.dotnet.framework.aspnet From: "savvy" <johng...@gmail.com> - Find messages by this author Date: 1 Feb 2006 08:23:19 -0800...
3
by: ABC | last post by:
What methods can export excel file from stored procedure with parameters which input from web form?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.