使用HyperLinkField传递多个值 [英] Passing multiple values using HyperLinkField

查看:196
本文介绍了使用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....

推荐答案

嘿,希望这对您有所帮助!
////////////////////JavaScript///////////////////
Hey hope this may help!!!

/////////////////////JavaScript///////////////////
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


我认为您的问题出在html中,特别是在网格内.请尝试将超链接控件放在列内的那些控件内:

I think that your problem is in the html,specifically inside the grid.Please try to put the hyperlink control inside those inside the column :

<asp:TemplateField>
                <ItemTemplate>


</ItemTemplate>
               
            </asp:TemplateField>


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆