zoukankan      html  css  js  c++  java
  • How To contain multiple fileds in the querystrig, DataNavigateUrlFormatString=xxx.asp?ID={0}&Name={1}

    <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

  • 相关阅读:
    使用WinDbg调试SQL Server——入门
    SQL Server里如何随机记录集
    相关列的基数计算
    自增长的聚集键值不会扩展(scale)
    使用正确的筛选参数来提高查询性能
    可更新聚集列存储索引幻想
    在SQL Server 2014里可更新的列存储索引 (Updateable Column Store Indexes)
    SQL Server 2014里的IO资源调控器
    SQL Server 2014里的针对基数估计的新设计(New Design for Cardinality Estimation)
    缓存池扩展 (Buffer Pool Extension)实践
  • 原文地址:https://www.cnblogs.com/cy163/p/27266.html
Copyright © 2011-2022 走看看