programatically controlling the datagrid

T

timcyberbanjo

Hi, I am new to using datagrids.
I am currently developing a webform where I can load and display data
using the OdbcConnection. (the data comes from Oracle RDB)
The data loads and displays fine, however, I want to be able to make a
hyperlink as an "additional" column to the datagrid that would allow
the user to link to a more detailed page.

I really would like to do this programatically, rather than using some
form of wizard, which is where I seem to keep getting led.

I will need to dynamically develop the hyperlink code, so it makes
sense that I add the "link" column in code.

Could someone out there point me in the right direction?

Many thanks in anticipation of a response.
 
J

Jeffrey Tan[MSFT]

Hi timcyberbanjo,

Thanks for your post!!

Based on my understanding, you want to add a hyperlink column to your
webform DataGrid, so that you can click the hyperlink and navigate to the
details page. If I misunderstand you, please feel free to tell me. Thanks

Yes, WebForm DataGrid is a Column-based DataBinding server control, which
we can add a lot of different columns in the DataGrid freely. Normally, we
can embeded any server child control in the DataGridColumn and make a
customized column for Asp.net DataGrid. However, Asp.net has several
build-in customized DataGridColumn for our usage, and HyperLinkColumn is
just one of these build-in columns. For details about how to use
HyperLinkColumn and how to add it into DataGrid, please refer to:
"Adding Hyperlink Columns to a DataGrid Web Server Control"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskaddinghyperlinkcolumnstodatagridwebcontrol.asp
and
"HyperLinkColumn Class"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwebuiwebcontrolshyperlinkcolumnclasstopic.asp

Generally, we can do the databinding with HyperLinkColumn using
"DataTextField" and "DataNavigateUrlField" properties of HyperLinkColumn.
Additionally, we may use "DataTextFormatString" and
"DataNavigateUrlFormatString" 2 properties for the formatting.

At last, the article below gives us a more deeply description about columns
usage in DataGrid, for your information:
"Creating Custom Columns for the ASP.NET Datagrid"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/creatingcustomcolumns.asp
==========================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi timcyberbanjo,

Does my reply make sense to you? Is your problem resolved? If you have any
concern, please feel free to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top