Problem with Hyperlink in GridView
am 19.12.2007 22:07:06 von Tor Inge Rislaa
When I insert the complete querystring into the NavigateUrl tag this
hyperlink works fine within the GridView.
NavigateUrl="~/Admindetail.aspx?ku_id=1" Text="Details"
If I try to let the parameter data be provided dynamically something strange
happen. I can see that the dynamical data is provided, with the right ku_id,
but the aspx file is removed from the URL
NavigateUrl="~/Admindetail.aspx?ku_id={0}" Text="Details" />
The first code gives something like
www.mysite.com/Admindetail.aspx?ku_id=1
this works OK
The second code gives something like
www.mysite.com/1
Am I configuring it incorrect?
TIRislaa
RE: Problem with Hyperlink in GridView
am 20.12.2007 04:01:01 von MohamadElarabi
Tor,
the NavigateURL is only used when specifying the same link for all rows.
Text attribute is also static accreoss the board. If you want the link to
include a value from a data field you should use the DataNavigateURLField
with the DataNavigateURLFormatString. The same goes for DataTextField and
DataTextFormatString if you want the link text to also be dynamic. Your tag
should look something like this
HeaderText="View Detail"
DataNavigateUrlField="ku_id"
DataNavigateUrlFormatString="~/Admindetail.aspx?ku_id={0}"
DataTextField="ku_id"
DataTextFormatString="Details for Record {0}" />
Good luck,
--
Mohamad Elarabi
Lead Developer. MCTS, MCPD.
"Tor Inge Rislaa" wrote:
> When I insert the complete querystring into the NavigateUrl tag this
> hyperlink works fine within the GridView.
>
>
>
>
> NavigateUrl="~/Admindetail.aspx?ku_id=1" Text="Details"
>
>
>
>
>
> If I try to let the parameter data be provided dynamically something strange
> happen. I can see that the dynamical data is provided, with the right ku_id,
> but the aspx file is removed from the URL
>
>
>
>
> NavigateUrl="~/Admindetail.aspx?ku_id={0}" Text="Details" />
>
>
>
> The first code gives something like
>
> www.mysite.com/Admindetail.aspx?ku_id=1
>
>
>
> this works OK
>
>
>
> The second code gives something like
>
> www.mysite.com/1
>
>
>
> Am I configuring it incorrect?
>
>
>
>
>
> TIRislaa
>
>
>
Re: Problem with Hyperlink in GridView
am 20.12.2007 21:07:48 von Tor Inge Rislaa
Thanks a lot, just what I needed.
Regards
TIRislaa
"Mohamad Elarabi" skrev i melding
news:E1F0054A-8E64-4CB6-8E6F-898056F44CC4@microsoft.com...
> Tor,
> the NavigateURL is only used when specifying the same link for all
> rows.
> Text attribute is also static accreoss the board. If you want the link to
> include a value from a data field you should use the DataNavigateURLField
> with the DataNavigateURLFormatString. The same goes for DataTextField and
> DataTextFormatString if you want the link text to also be dynamic. Your
> tag
> should look something like this
>
>
> HeaderText="View Detail"
> DataNavigateUrlField="ku_id"
> DataNavigateUrlFormatString="~/Admindetail.aspx?ku_id={0}"
> DataTextField="ku_id"
> DataTextFormatString="Details for Record {0}" />
>
> Good luck,
>
> --
> Mohamad Elarabi
> Lead Developer. MCTS, MCPD.
>
>
> "Tor Inge Rislaa" wrote:
>
>> When I insert the complete querystring into the NavigateUrl tag this
>> hyperlink works fine within the GridView.
>>
>>
>>
>>
>> NavigateUrl="~/Admindetail.aspx?ku_id=1" Text="Details"
>>
>>
>>
>>
>>
>> If I try to let the parameter data be provided dynamically something
>> strange
>> happen. I can see that the dynamical data is provided, with the right
>> ku_id,
>> but the aspx file is removed from the URL
>>
>>
>>
>>
>> NavigateUrl="~/Admindetail.aspx?ku_id={0}" Text="Details" />
>>
>>
>>
>> The first code gives something like
>>
>> www.mysite.com/Admindetail.aspx?ku_id=1
>>
>>
>>
>> this works OK
>>
>>
>>
>> The second code gives something like
>>
>> www.mysite.com/1
>>
>>
>>
>> Am I configuring it incorrect?
>>
>>
>>
>>
>>
>> TIRislaa
>>
>>
>>