tags:

views:

188

answers:

2

Hi Guys,

Apologies for the newbie question. My client wishes me to make a small change to the gridview on his http://www.flogitdonegal.com/SearchPage.aspx page.

Note the way the Title column is a hyperlink to view more information. This comes from a 'BriefDescription' field in the database.

How can I add 250 chars from the 'FullDescription' underneath the Title in the same cell, but I dont want it be a hyperlink.

Essentially it will be 2 fields coming into the same column.

Thanks in advance for all help. John

A: 

If this is using a GridView you are most likely using a TemplateField as it is to display the HyperLink.

Within the ItemTemplate of the TemplateField you can specify an additional Label underneath using something as follows:

<asp:Label runat="server" id="FullDescLabel" Text='<%# DataBinder.Eval(Container.DataItem, "FullDescription") %>' />
Tim
A: 

You need to use the TemplateField and here is a tutorial that explains some of the other fields that GridView offers as well.

<asp:GridView ID="gvwCompounds" runat="server" DataSourceID="objItemsFromYourDB">
  <Columns>
    ....
    <asp:TemplateField>
      <ItemTemplate  HeaderText="Title">
        <asp:HyperLink runat="server" ID="Hperlink1" NavigateUrl='<%# Eval("BriefDescriptionUrl") %>' Text='<%# Eval("BriefDescription") %>' />
        <br />
        <asp:Label runat="server" ID="Label1" Text='<%# Eval("FullDescription") %>'  />
      </ItemTemplate>
    </asp:TemplateField>
    ....
  </Columns>  
</asp:GridView>
David Glass

related questions