How To contain multiple fileds in the querystrig, DataNavigateUrlFormatString=xxx.asp?ID={0}&Nam

來源:互聯網
上載者:User

<asp:TemplateColumn HeaderText="稿件編號">
                        <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

     cmdManscript="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 a
hyperlink column. I am trying to figure out if it
possible to have more than one querystring parameter
inserted into each hyperlink using the
DataNavigateURLField.

It looks like you are only able to specify one column
from the datasource to insert as a value that differs for
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 a
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 would have hyperlinks that would 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/RhoTech)
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/RhoTech)
Hello Michael,

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

>>
            <asp:DataGrid id=DataGrid1 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 a
hyperlink column bound to title. In this dialog is a choice to convert to
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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.