Click here to Skip to main content
15,068,471 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Morning guys

I have a linkbutton inside my gridview, the linkbutton suppose to be doing 2 jobs, 1st it should execute a modalpopup and 2ndly it should be able to pass values to the controls inside the popup

The only thing it performs is to execute the popup. Below is my linkbutton

ASP.NET
<asp:LinkButton  ID="createAppointment" runat="server"  PostBackUrl='<%#"frmFindAppointment.aspx?Fullname=" + HttpUtility.UrlEncode(Eval("Fullname").ToString())+"&RecordNumber="+ HttpUtility.UrlEncode(Eval("RecordNumber").ToString())+"&Date="+  HttpUtility.UrlEncode(Eval("Date").ToString())+"&SlotID="+ HttpUtility.UrlEncode(Eval("SlotID").ToString())+"&Timeslot="+ HttpUtility.UrlEncode(Eval("Timeslot").ToString())+"&EmpEmail="+ HttpUtility.UrlEncode(Eval("EmpEmail").ToString())  %>' Text="Create Appointment" />


Below is how i recieve my 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["EmpEmail"] != null && !string.IsNullOrEmpty(Request.QueryString["EmpEmail"].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())))))
                {
                    string fullName = Convert.ToString((Request.QueryString["FullName"]));
                    Session["FullName"] = fullName;
                    this.txtViewStaffName.Text = Session["FullName"].ToString();


                    recNumber = Convert.ToInt32(Request.QueryString["RecordNumber"].ToString());

                    date = Request.QueryString["Date"].ToString();

                    slot = Convert.ToInt32(Request.QueryString["SlotID"].ToString());
                    Session["SlotID"] = slot;

                    this.ddlTimeSlots.Items.Add(Request.QueryString["Timeslot"].ToString());

                    Session["EmpEmail"] = (Request.QueryString["EmpEmail"].ToString());


                }


Now i see that the values are NULL because the if statement is skiped. I need help.
Posted
Updated 20-Sep-11 21:17pm
v2
Comments
Prerak Patel 21-Sep-11 3:18am
   
Code block added.
Anele Ngqandu 21-Sep-11 3:22am
   
thank you...it used to be added automaticaly now i dont know...
AditSheth 21-Sep-11 4:15am
   
can you post link of that :
frmFindAppointment.aspx?Fullname=&RecordNumber= and so on

Hi,
Try using Gridview's Row Command Event, make your link button like this

<asp:LinkButton  ID="createAppointment" runat="server" CommandArgument="<"FullName">" Text="Create Appointment" commandname="abc" /> 


and
on code write this

if(e.CommandName="abc")
//do what you want
   
Comments
Anele Ngqandu 21-Sep-11 3:35am
   
so should i create a RowCommand Event then put that if(e.CommandName)?
Syed Salman Raza Zaidi 21-Sep-11 3:56am
   
Yes
Anele Ngqandu 21-Sep-11 4:00am
   
no..not working
try changing if condition like below
VB
if (
                (Request.QueryString["Fullname"] != null && !string.IsNullOrEmpty(Request.QueryString["Fullname"].ToString()))
                ||
                (Request.QueryString["RecordNumber"] != null && !string.IsNullOrEmpty(Request.QueryString["RecordNumber"].ToString()))
                ||
                (Request.QueryString["EmpEmail"] != null && !string.IsNullOrEmpty(Request.QueryString["EmpEmail"].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()))
                )
            {

            }


i try with this and its working fine.
test.aspx?Fullname=test&RecordNumber=5&Date=12102010&SlotID=5&Timeslot=5&EmpEmail=test
   
v2
Comments
Anele Ngqandu 21-Sep-11 4:50am
   
also not working
AditSheth 21-Sep-11 5:07am
   
so problem is in gridview binding link.bcoz i test this and its works.
can you give me link that is created in linkbutton?
like i give text.aspx?FullName..

Thanks
Anele Ngqandu 21-Sep-11 5:19am
   
What i removed the ajaxpopup in my page, then the values where passed, Now evry time i use the popup the values are not passed, how can i solve this
AditSheth 21-Sep-11 6:22am
   
ok see this link
http://mattberseth.com/blog/2007/07/confirm_gridview_deletes_with.html
pass query string in Command Argument
thanks

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