473,671 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 SelectedItemSty le 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 2360
Handle the ItemCommand event and set the SelectedIndex.

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

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

Sub DoItemSelect(ob jSource As Object, objArgs As DataGridCommand EventArgs)

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

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

End If

End Sub


"Zachary Hilbun" <gu****@vianova .com> wrote in message
news:sI******** ********@newssv r12.news.prodig y.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 SelectedItemSty le 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**@stonebroo m.com> wrote in message
news:%2******** *******@TK2MSFT NGP14.phx.gbl.. .
Handle the ItemCommand event and set the SelectedIndex.

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

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

Sub DoItemSelect(ob jSource As Object, objArgs As DataGridCommand EventArgs)

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

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

End If

End Sub


"Zachary Hilbun" <gu****@vianova .com> wrote in message
news:sI******** ********@newssv r12.news.prodig y.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 SelectedItemSty le 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******** *********@newss vr12.news.prodi gy.com...
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**@stonebroo m.com> wrote in message
news:%2******** *******@TK2MSFT NGP14.phx.gbl.. .
Handle the ItemCommand event and set the SelectedIndex.

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

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

Sub DoItemSelect(ob jSource As Object, objArgs As DataGridCommand EventArgs)
'see if it was the Select button that was clicked
If objArgs.Command Name = "Select" Then

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

End If

End Sub


"Zachary Hilbun" <gu****@vianova .com> wrote in message
news:sI******** ********@newssv r12.news.prodig y.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 SelectedItemSty le 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
1989
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 populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show this table.
2
1145
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 inserted row? I need to obtain its position in the datagrid... Any help is really welcome.
1
10928
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 my datalist has an id of "Datagrid3". dgChild comes back with "Nothing" while debugging. Here is my code in the itemdatabound event for the datalist: <code>
5
7316
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 the results to a list control on the containing .ASPX page. Here is what I have in my code behind (C#): <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication5.WebForm1" %> <!DOCTYPE HTML PUBLIC...
5
1909
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
1563
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 forms. Is datagrid control support multi-select features? Is datagrid control support paging feature to access tables (because some tables has more than 100000 records!!)? Has any best ideas?
4
1793
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 somehow want to reset the label value through javascript? I could grab the id of the row that had the label in it (now converted to a span at client side) by accessing the corresponding hidden field with it. var hdnLabel =...
0
1040
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 Local: Wed, Feb 1 2006 4:23 pm Subject: How to Pre-Select a DataGrid Row Radiobutton ? Reply | Reply to Author | Forward | Print | Individual Message | Show original | Remove | Report Abuse
3
2592
by: ABC | last post by:
What methods can export excel file from stored procedure with parameters which input from web form?
0
8474
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8392
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8912
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5692
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.