How to contain multiple fileds in the querystrig, datanavigateurlformatstring = xxx. asp? Id = {0} & Nam

Source: Internet
Author: User

<Asp: templatecolumn headertext = "Manuscript No.">
<Itemtemplate>
<Asp: hyperlink runat = "server" text = '<% # databinder. eval (container. dataitem, "eventpaperid") %>'
Navigateurl = '<% # "commonprocessplatform. aspx" + "? "+" Paperid = "+ databinder. eval (container. dataitem, "eventpaperid") + "& event =" + databinder. eval (container. dataitem, "eventevent") %> 'target = _ blank id = "hyperlink1">
</ASP: hyperlink>
</Itemtemplate>
</ASP: templatecolumn>

It is noticable that in the above Code, some strange variable names are used such as eventpaperid, eventevent, etc. those variables are used due to the SQL query is a join query between tables event and manuscript.

The SQL statement is as follows

Optional manscript = "select event. ID as eventid, event. event as eventevent, event. outstanding as eventoutstanding, event. date as eventdate, event. paperid as eventpaperid, manuscript. authorname as manuscriptauthorname from event, manuscript "+ strwhere +" and event. paperid = manuscript. paperid order by event. date DESC ";

The following referece is good enlightening Material
Http://www.dotnet247.com/247reference/msgs/13/66028.aspx

Am using a DataGrid to display 3 bound columns and
Hyperlink column. I am trying to figure out if it
Possible to have more than one querystring Parameter
Inserted into each hyperlink using
Datanavigateurlfield.

It looks like you are only able to specify one column
From the datasource to insert as a value that differs
Each row. The example below is one I found in the msdn
Documentation which shows one datanavigatefield AND ITS
Format String.
--------------
<Columns>
<Asp: hyperlinkcolumn
Headertext = "select an item"
Datanavigateurlfield = "integervalue"
Datanavigateurlformatstring = "detailspage. aspx? Id =
{0 }"
/>
</Columns>
--------------

Conceptually what I want to be able to do is have
Format String that looks like:

Datanavigateurlformatstring = "detailspage. aspx? P0 = {0} & p1 =
{1 }"

So that I can have two query string parameters be
Populated from two different columns in the datasource.
The Rows wowould have hyperlinks that wowould look like:

Www.somesite.com/somepage.aspx? P0 = 2 & p1 = 23
Www.somesite.com/somepage.aspx? P0 = 5 & p1 = 19
Www.somesite.com/somepage.aspx? P0 = 8 & p1 = 99
.....

Is there a way to do this?

Thanks
Michael

Reply to this message...
 
Robert E. Duke (COMFORCE/FIG)
Hello Michael,

what you are wanting to do seems very reasonable. let me pound on it here
a bit and I'll get you an answer.

thanks,
Robert Duke
Microsoft Developer support

this posting is provided "as is" with no warranties, and confers no rights.
you assume all risk for your use. 2001 Microsoft Corporation. all rights
reserved.

reply to this message...
Robert E. Duke (COMFORCE/FIG)
Hello Michael,

It turns out that this is pretty easy to do. Here is the code:

>
<Asp: DataGrid id = maid style = "Z-INDEX: 101; left: 8px; position:
Absolute; top: 8px "runat =" server "datasource =" <% # dataset11 %> ">
<Columns>
<Asp: templatecolumn headertext = "url">
<Itemtemplate>
<Asp: hyperlink runat = "server" text = '<% # databinder. eval (container,
"Dataitem. Title") %>'
Navigateurl = '<% # databinder. eval (container, "dataitem. Title") + "? "
+
Databinder. eval (container, "dataitem. title_id") + "&" +
Databinder. eval (container, "dataitem. pub_id") %> '>
</ASP: hyperlink>
</Itemtemplate>
</ASP: templatecolumn>
</Columns>
</ASP: DataGrid>
<

What I did was create a project with a DataGrid populated from the pubs
Database/titles table. I went into property builder and defined
Hyperlink column bound to title. In this dialog is a choice to convert
A itemtemplate. You can pretty much do what you want at this point.
Above, I passed the title_id and pub_id in the query string.

Let me know if you have any questions. Hopefully this is what you are
After!

Enjoy,
Robert Duke
Microsoft Developer support

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.