Click here to Skip to main content
15,900,457 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

XML
<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

C#
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....
Posted
Updated 15-Jul-11 1:39am
v4
Comments
Mathews Davis 15-Jul-11 7:14am    
I think its problem with your code...Passing 4 values in hyperlink is not at all a problm...Plz submit ur code..
[no name] 15-Jul-11 7:15am    
Show us your code.

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 :

XML
<asp:TemplateField>
                <ItemTemplate>

XML
</ItemTemplate>
               
            </asp:TemplateField>
 
Share this answer
 
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 + "')");           
        }
    }


If there is some problem let me know...k
 
Share this answer
 
v4
Comments
Anele Ngqandu 15-Jul-11 7:40am    
Does the "i" in e.Row.Cells[i] comes from the "for loop"?
Anele Ngqandu 15-Jul-11 7:41am    
Or suppose to b a 1?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900