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

  • 相关阅读:
    【工具类】Stream流构建指定长度的时间集合
    【Java】 Java中的浅拷贝和深拷贝
    【网络协议】 TCP三次握手的流程
    【工具库】Java实体映射工具MapStruct
    【并发编程】Java中的锁有哪些?
    【ORM】Mybatis与JPA的区别
    【并发编程】ThreadLocal
    【SpringBoot】SpringBoot 处理后端返回的小数(全局配置 + 定制化配置)
    实战开发三步走
    项目:jSon和Ajax登录功能
  • 原文地址:https://www.cnblogs.com/cy163/p/27266.html
Copyright © 2011-2022 走看看