asp.net 1.1 datagrid and DataNavigateUrlFormatString

G

Guest

All,

I am using a datagrid on a 1.1 .aspx page that has a hyperlink column. I am
using 'DataNavigateUrlFormatString' to set the URL to browse to once the user
clicks on the link i.e.

DataNavigateUrlFormatString="www.somedomain.com/link.aspx?id={0}"

What I would like to do is get the "www.somedomain.com" from my web.config
and concat the "/link.aspx?id={0}".

Can some tell me how I can code this please?

Thanks
Msuk
 
C

CK

In the VS 2003 edit your web config;
<appSettings>

<add key="SomeDomain" value="www.somedomain.com"/>

</appSettings>

Then in the code use

DataNavigateUrlFormatString= ConfigurationSettings.AppSettings["SomeDomain"]
+ "//link.aspx?id{0}";

that should work. You may or may not need the double forward slash. Also add
System.Configuration reference to a page that would use this.

HTH,

~CK
 
G

Guest

Hi,

Again can anyone please help me with this?

Thanks
Msuk

msuk said:
Hi,

I got the following error:

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Literal content ('<asp:HyperLinkColumn
DataNavigateUrlField="id"
DataNavigateUrlFormatString=ConfigurationSettings.AppSettings["webRoot"] +
"//link.aspx?id={0}" DataTextField="name" HeaderText="Document">
</asp:HyperLinkColumn>') is not allowed within a
'System.Web.UI.WebControls.DataGridColumnCollection'.

Source Error:


Line 131: <HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#999999"></HeaderStyle>
Line 132: <Columns>
Line 133: <asp:HyperLinkColumn DataNavigateUrlField="id"
DataNavigateUrlFormatString=ConfigurationSettings.AppSettings["webRoot"] +
"//showpdf.aspx?id={0}" DataTextField="name" HeaderText="Document">
Line 134:
Line 135: </asp:HyperLinkColumn>


I also tried with a single '/' and get the same message. I placed the
'Imports System.Configuration' in the code behind for the page is this
correct?

Thanks
msuk

CK said:
In the VS 2003 edit your web config;
<appSettings>

<add key="SomeDomain" value="www.somedomain.com"/>

</appSettings>

Then in the code use

DataNavigateUrlFormatString= ConfigurationSettings.AppSettings["SomeDomain"]
+ "//link.aspx?id{0}";

that should work. You may or may not need the double forward slash. Also add
System.Configuration reference to a page that would use this.

HTH,

~CK




msuk said:
All,

I am using a datagrid on a 1.1 .aspx page that has a hyperlink column. I
am
using 'DataNavigateUrlFormatString' to set the URL to browse to once the
user
clicks on the link i.e.

DataNavigateUrlFormatString="www.somedomain.com/link.aspx?id={0}"

What I would like to do is get the "www.somedomain.com" from my web.config
and concat the "/link.aspx?id={0}".

Can some tell me how I can code this please?

Thanks
Msuk
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top