Please help with DataNavigateUrlFormatString property issue with the DataGrid

R

RobT

Hi,

I've been using the DataGrid control in my ASP.NET web page. The page is
used to search for records in the database. The control is bound to a
DataSource and gets populated ok. I am also using a Hyperlink column in
the grid to allow the user to redirect to another page, again that works
fine.

My problem is when I want to call the ASP.NET search page from more than
one page because I cannot find a way to programatically set the
"DataNavigateUrlFormatString" property of the HyperLink control. I need
to do this to allow the page to navigate to different pages depending on
which page called this page.

Any help would be appreciated, I've added the code from my control below
but would like to be able to set the DataNavigationUrlFormatString
property to something like

DataNavigateUrlFormatString="<%=MyString%>"

instead of


PublicFunder.aspx?FunderID={0}

But this does not seem to work.

Thanks in advance
Rob



<asp:datagrid id="grdSearchResults" tabIndex="6" runat="server"
CssClass="Grid" Width="457px"
Visible="False" AutoGenerateColumns="False">
<AlternatingItemStyle CssClass="GridAlternatingRow
"></AlternatingItemStyle>
<HeaderStyle CssClass="GridHeader"></HeaderStyle>
<Columns>
<asp:HyperLinkColumn Text="Choose" DataNavigateUrlField="FunderID"
DataNavigateUrlFormatString="PublicFunder.aspx?FunderID={0}"></asp:Hyper
LinkColumn>
<asp:BoundColumn DataField="FunderId" ReadOnly="True"
HeaderText="Funder Id"></asp:BoundColumn>
<asp:BoundColumn DataField="FunderName" ReadOnly="True"
HeaderText="Name"></asp:BoundColumn>
</Columns>
</asp:datagrid>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top