Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can define columns for the GridView. In your case, it sounds like to me that you would need a column that is of type <code>HyperLinkField</code>. In that class, you can specify the properties <code>DataNavigateUrlFields</code> and <code>DataTextField</code>. The DataTextField allows you to specify the name of the field from the DataSource that contains the display text, which in your case sounds like it would be the Title column. The DataNavigateUrlFields allows you to specify the field(s) from the DataSource used to populate the URL - in your case it sounds like this would be the 'Link' column from the data source. I am not sure exactly how you are doing things, but the snippet below shows you how to add a HyperLink column to your GridView. Based on the code you provided, it doesn't look like you were manually defining the columns to use, but if you want the required behavior you may have to manually define all the columns you need. </p> <pre class="lang-c# prettyprint-override"><code> HyperLinkField titleLinkField = new HyperLinkField(); titleLinkField.DataTextField = "Title"; //Column name providing hyperlink title titleLinkField.DataNavigateUrlFields = "Link"; //Column providing the URL to use. gridSearchResults.Columns.Add(titleLinkField); </code></pre> <p>As far as defining alternating row styles, you can set properties within that property. You may set each property individually, or define a CSS class to use.</p> <pre class="lang-c# prettyprint-override"><code> gridSearchResults.AlternatingRowStyle.CssClass = "myAlternatingClass"; gridSearchResults.RowStyle.CssClass = "myRegularClass"; // OR gridSearchResults.AlternatingRowStyle.ForeColor = Drawing.Color.Blue; gridSearchResults.RowStyle.ForeColor = Drawing.Color.Green; </code></pre> <p>Edit: Paolo Tedesco beat me to it, and he did have one bit that I was missing. You do need to specify the AutoGenerateColumns to False on your GridView.</p> <p>For regular fields, you should use basically the same as above, but instead of using HyperLinkField, you can use a BoundField.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload