Results 1 to 4 of 4

Thread: Help with formatting a HyperLinkColumn in Datagrid

  1. #1

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Help with formatting a HyperLinkColumn in Datagrid

    Here is what I am doing in a datagrid for the colums:
    Code:
    <Columns>
        <asp:HyperLinkColumn DataNavigateUrlField="CatID"
        DataNavigateUrlFormatString=
        "../VXForums/Index.aspx?CatID={0}" 
        DataTextField="CatName" HeaderText="Category">
        </asp:HyperLinkColumn>
        <asp:BoundColumn DataField="CatDescription" 
        HeaderText="Description">
        </asp:BoundColumn>
    </Columns>
    The problem I have is I want two values in the query string, both comming from the dataset that is databound to the datagrid. Right now, the link looks like this when ran:
    ../VXForums/Index.aspx?CatID=1
    ../VXForums/Index.aspx?CatID=2
    etc...

    I want it to look like this:
    ../VXForums/Index.aspx?CatID=1&SecID=8
    ../VXForums/Index.aspx?CatID=2&SecID=9
    etc...

    The SecID is comming from the dataset.

    So the question is, how do I get two values from the dataset into the DataNavigateUrlFormatString property, and/or how do I get two values into the DataNavigateUrlField?

    If you need more information, just ask, this is pretty important to the project.

  2. #2

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Never mind, I used a custom binding expression to achieve what I wanted.

    Here is the expression in case someone else has this problem.

    DataBinder.Eval(Container, "DataItem.CatID", "../VXForums/Index.aspx?CatID={0}") + DataBinder.Eval(Container, "DataItem.SecID","&SecID={0}")

  3. #3
    Lively Member
    Join Date
    Mar 2002
    Location
    S.A
    Posts
    89
    thanks for the code tip... i wondered the same a few days ago.
    I forgot my password....

  4. #4

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Glad to help out. It took me a while to figure it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width