本文介绍了使用HyperLinkField传递多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在使用HyperLinkField传递值,当我传递4个值时出现问题,链接不显示.所以3的最大数值是
可以使用HyperLinkField进行解析还是我做错了什么?

Gridview标记

Hi guys, am passing values using HyperLinkField, Problems comes when i pass 4 values, the links dont show. So is 3 the maximum number of values
that can be parsed using HyperLinkField or am I doing something wrong?

Gridview Markup

<asp:GridView  ID="grdAvailableStaff"  runat="server" CellPadding="4"

               EnableSortingAndPagingCallbacks="true" AllowPaging="True"

                PageSize="5"

               Width="423px" onrowdatabound="grdAvailableStaff_RowCreated"

               ForeColor="#333333" GridLines="None" Height="16px"

               ShowHeaderWhenEmpty="True"

               >
               <AlternatingRowStyle BackColor="White" />
               <Columns >
                  <asp:HyperLinkField HeaderText="Create Appointment"  Text="Create Appointment"

               DataNavigateUrlFormatString="frmFinalizeAppointment.aspx?Fullname={0}&RecordNumber={1}&Date={2}&SlotID={3}&TimeSlot={4}"  DataNavigateUrlFields="Fullname,RecordNumber,Date,SlotID,TimeSlot" />
               </Columns>
               <EditRowStyle BackColor="#2461BF" />
               <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
               <HeaderStyle Height="2px" BackColor="#507CD1" Font-Bold="false" ForeColor="White" />
               <PagerSettings PageButtonCount="5" />
               <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
               <RowStyle BackColor="#EFF3FB" />
               <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
               <SortedAscendingCellStyle BackColor="#F5F7FB" />
               <SortedAscendingHeaderStyle BackColor="#6D95E1" />
               <SortedDescendingCellStyle BackColor="#E9EBEF" />
               <SortedDescendingHeaderStyle BackColor="#4870BE" />
           </asp:GridView>





获取传递值的页面的代码





Code for page that gets passed values

if (Request.QueryString["Fullname"] != null && !string.IsNullOrEmpty(Request.QueryString["Fullname"].ToString()) || 
   (Request.QueryString["RecordNumber"] != null && !string.IsNullOrEmpty(Request.QueryString["RecordNumber"].ToString()) ||
   (Request.QueryString["Date"] != null && !string.IsNullOrEmpty(Request.QueryString["Date"].ToString())) || 
   (Request.QueryString["SlotID"] != null && !string.IsNullOrEmpty(Request.QueryString["SlotID"].ToString())) || 
   (Request.QueryString["Timeslot"] != null && !string.IsNullOrEmpty(Request.QueryString["Timeslot"].ToString()))))
{
    this.txtViewStaffName.Text = Request.QueryString["Fullname"].ToString();
    recNumber = Convert.ToInt32(Request.QueryString["RecordNumber"].ToString());
    date = Request.QueryString["Date"].ToString();
    slot = Convert.ToInt32(Request.QueryString["SlotID"].ToString());
    this.ddlTimeSlots.Text = Request.QueryString["Timeslot"].ToString();
}




不确定是否足够....




Not sure if thats enough....

推荐答案

function open_win(link) 
{
window.open(link);
}


////////////////////////////////////////////////////////////

/*******************************网格视图***************** *******************/


/////////////////////////////////////////////////////////

/*******************************GridView************************************/

<asp:TemplateField>
       <itemtemplate>
    <asp:HyperLink ID="HyperLink4" runat="server" ForeColor="Black" NavigateUrl="#">Details
      </itemtemplate>


/***************************************************** ****************************/

/////////////////////////////////后面的代码//////////////////////////////


/****************************************************************************/

//////////////////////////////////Code behind///////////////////////////////

protected void GVInbox_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataTable dtNEW = new DataTable();
        dtNEW = (DataTable)Session["Inbox"];
        if (e.Row.RowIndex > -1)
        {
           
            string strLink1 = "Page.aspx?id=" + value + "&mid=" + value + "";
            //((HyperLink)e.Row.Cells[5].Controls[1]).NavigateUrl = strLink1;
            ((HyperLink)e.Row.Cells[i].Controls[1]).Attributes.Add("onclick", "open_win(''" + strLink1 + "'')");           
        }
    }



如果有问题,请告诉我... k



If there is some problem let me know...k


<asp:TemplateField>
                <ItemTemplate>


</ItemTemplate>
               
            </asp:TemplateField>


这篇关于使用HyperLinkField传递多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:59