473,770 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Choosing a datagrid column

I want to display a column in a datagrid such that each item/row in
that column acts as a hyperlink. Further, when I click on the
hyperlink, it doesn't redirect to another page or even to itself.
Rather it "POSTS" pack to itself, and fetches the values in the entire
row into the textboxes displayed on the same page outside of the data
grid.
From my understanding of this, I believe I have two courses I could

follow.

1. To take a ButtomColumn for the column under question. When the
button column is clicked, I get the row as DataGridEventAr gs.Item in
the OnItemCommand handler I define.

This would've worked all well for me had I not made the DataSource of
the grid my own defined class that derives from DictionaryBase. The
class, let's call it Group, is a strongly types collection of a class
GroupMember. GroupMember, let's assume, has three properties, ID,
MemberName and Email. The column I need to make a hyperlink is the
MemberName column.

Since the datasource of the grid is a collection and not a dataset, I
cannot use the DataTextField property like so:

<asp:ButtonColu mn
HeaderText = "Member Name"
DataTextField = "MemberName " />

because the collection does not have a property called MemberName.
Instead, it has a key property and a Value property. The value property
is the GroupMember Object that has a MemberName property. However, I
cannot even do this:
<asp:ButtonColu mn
HeaderText = "Member Name"
DataTextField = "Value.MemberNa me" />

The grid won't bind the DataBind() call.

Neither can I use the DataBinder single-value binding on the
ButtonColumn event like so:
<asp:ButtonColu mn
HeaderText = "Member Name"
DataTextField = '<%# DataBinder.Eval (Container.Data Item,
"Value.MemberNa me")%>' />
because the ButtonColumn class does not support the DataBinding event.

2. Use the TemplateColumn. If I use the TemplateColumn like so,

<asp:TemplateCo lumn HeaderText="Mem ber Name">
<ItemTemplate >
<%# DataBinder.Eval (Container.Data Item, "Value.MemberNa me")
%> </ItemTemplate>
</asp:TemplateCol umn>

It works fine but I do not have hyperlinks, so the main purpose is not
solved.

Can you please suggest me a solution to my problem? How do I get a
hyperlinked column into the grid that reads values from the datasource
of the grid, which is of type System.Collecti ons.DictionaryB ase, and
such that clicking on the links post back to the same page?

Nov 19 '05 #1
0 1126

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

Similar topics

5
2640
by: Jean Carlo | last post by:
Hello guys I`m developing a windows form that contain one Datagrid. In this datagrid I insert a checkBox Column. I need to get all rows where checkbox is checked by user. How do I get this rows ? I can´t use the DataSource of Datagrid because I don´t have a Column source for checkBox in my DataSource. Is there any method in datagrid to loop in datagrid rows ?
0
1733
by: Pietje de kort | last post by:
Hello, why is the System.Windows.Forms.DataGrid so un-customizable? I am trying to build a DataGrid that will resize it's last column when there is room left over (make it fill the total clientwidth). I am almost capable of doing so by the following actions: - Create a custom DataGridTableStyle called AutoResizeDataGridTableStyle - Hook up the OnResize and OnDataSourceChanged from the AutoResizeDataGridTableStyle to their respected...
2
1500
by: Julie | last post by:
I have the following need for a custom control. Two columns, n rows. Column 1 is simple text (non-editable). Column 2 is drop-down combo boxes (1 for each row). Needs to be sortable (with column headers).
3
4866
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is there any way of including column headings when copying/pasting from a running datagrid to notepad? At this stage it looks like I have to write my own code but would rather not if someone knows how to do it.
0
1704
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a single worksheet into a dataset. I successfully built a dynamic datagrid. And I did successfully bind it to the dataset. Then I added the datagrid control to a PlaceHolder. The first worksheet displays beautifully. The next step is to allow...
2
6414
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
4
1812
by: Anthony | last post by:
Hi Folks, I'm adding some columns to my datagrid which are of Combo Box type. I'm inheriting DataGridTextBoxColumn and doing all the usual stuff to get them populated. This is working fine. I have added some functionality where if the user right clicks the combobox a context menu will appear, saying "Fill the complete column with value 'XXX'". This value is the value they selected from the combobox. This is also working fine. However,...
10
4953
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than the column order of the datatable). I also allow the user to click on a column header to sort the datagrid by that column. I need to identify the row and column in the datatable when the user clicks on a cell in the datagrid. Using the...
2
6595
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
9454
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,...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
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
5354
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.