Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Datagrid query

Posted on 2003-03-04
Medium Priority
Last Modified: 2008-03-17

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.
Question by:Rob_Saville

Author Comment

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

Expert Comment

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.

Accepted Solution

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

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month13 days, 1 hour left to enroll

580 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