Row selection and highlighting using Web Control Datagrid?

G

Guest

I have been looking and looking but can't seem to find out how to get the row
selected in a web control datagrid (NOT a web form datagrid!!!), and how to
highlight the selected row. I'm sure this question comes up all the time but
I can't find the solution(s) anywhere. From what I understand, the web
control datagrid doesn't have any row selected or row highlighting
capabilities. What kind of hack am I going to have to put into place?
Sample code would be greatly appreciated. Thanks again!
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

What is the difference between a web control datagrid and a web form
datagrid?

You can use the SelectedItemStyle and SelectedItem/SelectedIndex properties.


cheers,
 
G

Guest

Sorry, I meant web control DataGrid vs windows form DataGrid. There are
differences between the two:

Windows Forms versus Web Forms DataGrid Control

The Web Forms DataGrid control is not the same as the Windows Forms
equivalent. It is a common (and not unreasonable) assumption that they are
the same control, or at least have identical functionality. However, the
entire programming paradigm for Web Forms is quite different from that for
Windows Forms. For example, Web Forms pages perform a round trip to the
server for any processing; they must manage state; they feature a very
different data-binding model; and so on.

Because of these differences, there are also significant differences in
their respective controls, including the DataGrid control. As a general rule,
the Web Forms DataGrid control includes less built-in functionality. A few
examples of differences in the Web Forms DataGrid control are:

* It does not inherently support master-detail data structures.
* As with other Web server controls, it does not support two-way data
binding. If you want to update data, you must write code to do this yourself.
* You can only edit one row at a time.
* It does not inherently support sorting, although it raises events you
can handle in order to sort the grid contents.

On the other hand:

* You can bind the Web Forms DataGrid to any object that supports the
IEnumerable interface.
* The Web Forms DataGrid control supports paging.
* It is easy to customize the appearance and layout of the Web Forms
DataGrid control as compared to the Windows Forms one. (Details are provided
later in this paper.)
 

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

Top