Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Multi-parameter query string in hyperlink column...

Reply
Thread Tools

Multi-parameter query string in hyperlink column...

 
 
Steve Kallal
Guest
Posts: n/a
 
      04-27-2004
I have found some postings on multi-parameter hyperlinks. But none of them involve calling a javascript function. I have almost got the NavigateUrl property to work, but not quite. Here is the DataGrid definition

<aspataGrid id="grid" runat="server" Width="99%" AutogenerateColumns="false" AllowPaging="True
AllowCustomPaging="True"><AlternatingItemStyle CssClass="datagrid_alternating_item"></AlternatingItemStyle><ItemStyle CssClass="datagrid_item"></ItemStyle><HeaderStyle CssClass="tableheader" BackColor="SteelBlue"></HeaderStyle><Columns><asp:TemplateColumn><ItemTemp late><asp:HyperLink id=lnkID runat="server" NavigateUrl='<%# "javascript:ShowForm(accountID=" & Server.UrlEncode(Container.DataItem("AccountKey")) & "&LDCID=" & Server.UrlEncode(Container.DataItem("LDCID")) & ")" %>
text='<%#Container.DataItem("RowNum")%>'></asp:HyperLink></ItemTemplate></asp:TemplateColumn></Columns><PagerStyle HorizontalAlign="Right" Position="TopAndBottom" CssClass="field" Mode="NumericPages"></PagerStyle></aspataGrid

I am able to get the hyperlink URL at runtime set to

javascript:ShowForm(accountID=267425&LDCID=SCE

But what I really need is

javascript:ShowForm('accountID=267425&LDCID=SCE'

The single quote characters surrounding the parameter to the ShowForm Javascript function is a real annoyance. How do I do this without resorting to code of the ItemDataBound event

Thanks in advance

 
Reply With Quote
 
 
 
 
Michael Tkachev
Guest
Posts: n/a
 
      04-27-2004
Hi,

try to write like this - '''

For example:

NavigateUrl='<%# "javascript:ShowForm('''accountID=" &
Server.UrlEncode(Container.DataItem("AccountKey")) & "&LDCID=" &
Server.UrlEncode(Container.DataItem("LDCID")) & ")''" %>'



"Steve Kallal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have found some postings on multi-parameter hyperlinks. But none of them

involve calling a javascript function. I have almost got the NavigateUrl
property to work, but not quite. Here is the DataGrid definition:
>
> <aspataGrid id="grid" runat="server" Width="99%"

AutogenerateColumns="false" AllowPaging="True"
> AllowCustomPaging="True"><AlternatingItemStyle

CssClass="datagrid_alternating_item"></AlternatingItemStyle><ItemStyle
CssClass="datagrid_item"></ItemStyle><HeaderStyle CssClass="tableheader"
BackColor="SteelBlue"></HeaderStyle><Columns><asp:TemplateColumn><ItemTemp la
te><asp:HyperLink id=lnkID runat="server" NavigateUrl='<%#
"javascript:ShowForm(accountID=" &
Server.UrlEncode(Container.DataItem("AccountKey")) & "&LDCID=" &
Server.UrlEncode(Container.DataItem("LDCID")) & ")" %>'
>

text='<%#Container.DataItem("RowNum")%>'></asp:HyperLink></ItemTemplate></as
p:TemplateColumn></Columns><PagerStyle HorizontalAlign="Right"
Position="TopAndBottom" CssClass="field"
Mode="NumericPages"></PagerStyle></aspataGrid>
>
> I am able to get the hyperlink URL at runtime set to:
>
> javascript:ShowForm(accountID=267425&LDCID=SCE)
>
> But what I really need is:
>
> javascript:ShowForm('accountID=267425&LDCID=SCE')
>
> The single quote characters surrounding the parameter to the ShowForm

Javascript function is a real annoyance. How do I do this without resorting
to code of the ItemDataBound event.
>
> Thanks in advance!
>



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      04-27-2004
Hi Steven,

As for the problem on the quotes in DataBind experssion in VS.NET when
switch from htmlview to design view, it's a known behavior. We can use the
following experssion syntax to overcome it:

<asp:HyperLinkColumn NavigateUrl='<%# "javascript:ShowForm("""accountID=" +
DataBinder.Eval(Container.DataItem,"index") + """")" %>'>

use """ to represent the quote between the upper level quote

In addition, here is a former thread discussing the same problem and you
can also find the solution in it:

#problem with quotes in vs.net
http://groups.google.com/groups?hl=z...&threadm=BR0Cu
lJxDHA.1272%40cpmsftngxa07.phx.gbl&rnum=3&prev=/groups%3Fhl%3Dzh-CN%26lr%3D%
26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dquote%2Bsteven%2Bcheng

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      04-29-2004

Hi Steve,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert url with query string to url without query string nick Javascript 1 02-13-2011 11:20 PM
GridView Hyperlink column that includes unique id in query string Frank Milverckowitz ASP .Net 1 05-18-2007 09:16 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
Dynamically Hyperlink and Event Handler for the Hyperlink ? Ken ASP .Net Datagrid Control 1 08-15-2003 11:38 PM
Hyperlink Template Column w Query String Carl Howarth ASP .Net Datagrid Control 0 07-24-2003 09:57 AM



Advertisments