473,424 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,424 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 2339
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.