?
Solved

Datagrid query

Posted on 2003-03-04
3
Medium Priority
?
273 Views
Last Modified: 2008-03-17
Hi

Working with ASP.NET

I'm interogating each value in a datagrid with the ItemCreated event.

What i'm trying to do is, search for a specified string in a column, if it equals that then set the appropriate DataNavigateURL property, something like this:

               DataGrid dg = (DataGrid)sender;
               HyperLinkColumn hlk = null;
               string str = (string)DataBinder.Eval(e.Item.DataItem, "Status");
               if (str != null)
               {
                    string strStatus = str.Trim();
                    if (strStatus == "FREE")
                    {
                         hlk = (HyperLinkColumn)dg.Columns[1];
                         hlk.DataNavigateUrlField = "RoomID";
                         hlk.DataNavigateUrlFormatString = "BookRoom.aspx?RoomID={0}";

This works fine, however

1) If i set this for just one row all of them become underlined, is there a way to just underline certain ones?

2) Can i have more than one querystring, ie i would like to do something like this;


hlk.DataNavigateUrlField = "RoomID,BookedBy";
                         hlk.DataNavigateUrlFormatString = "BookRoom.aspx?RoomID={0}&BookedBy={1}";

But that doesn't work.

Help appreciated.
0
Comment
Question by:Rob_Saville
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:Rob_Saville
ID: 8078877
Does no one know the answer to this one????
0
 

Expert Comment

by:andave
ID: 8078969
You could edit the line :

string str = (string)DataBinder.Eval(e.Item.DataItem, "Status");


to read;

endstring str = (string)DataBinder.Eval(e.Item.DataItem,,, "Status");

But not sure this will help.
0
 
LVL 4

Accepted Solution

by:
MrGhost earned 400 total points
ID: 8086425
use styles with attributes.add, maybe this is all you need!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question