Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass values of one page to 2nd but on 1st page i want show popup for login on linkbutton. i am using listview

//mycode on 1st page linkbuttn in listview


C#
protected void LstvwProSubCat_ItemCommand(object sender, ListViewCommandEventArgs e)
    {

        if (ProfileID == 0)
        {
            MpeLogin.Show();
            //MessageBox.Show("To View Product Title You Need To Login First");

        }
        else
        {
            if (e.CommandName == "ProSubCategary")
            {
              );

                string[] args = e.CommandArgument.ToString().Split(new char[] { ',' });
                int pgid = Convert.ToInt32(args[0]);
                int pcid = Convert.ToInt32(args[1]);
                int psdid = Convert.ToInt32(args[2]);
                Server.Transfer("product_title.aspx?pgid='" + pgid + "' & pcid='" + pcid + "'&psdid='" + psdid + "'");
            }

        }
    }


//code for popup

C#
protected void BtnATLogin_Command(object sender, CommandEventArgs e)
    {
        if (e.CommandName == "Login")
        {
            string[] args = e.CommandArgument.ToString().Split(new char[] { ',' });
            int pgid = Convert.ToInt32(args[0]);
            int pcid = Convert.ToInt32(args[1]);
            int psdid = Convert.ToInt32(args[2]);
            Server.Transfer("product_title.aspx?pgid='" + pgid + "' & pcid='" + pcid + "'&psdid='" + psdid + "'");
        }
    }

//next page
C#
string val1 = Request.QueryString[0];
        string val2 = Request.QueryString[1];
        string val3 = Request.QueryString[2];
Posted
Comments
[no name] 2-Feb-13 1:52am    
What is error ? Where do you stuck ?
Member 9579525 2-Feb-13 1:58am    
error is "input string is not in correct format"
[no name] 2-Feb-13 2:06am    
at which line ?

1 solution

Potential place looks like:
C#
int pgid = Convert.ToInt32(args[0]);
int pcid = Convert.ToInt32(args[1]);
int psdid = Convert.ToInt32(args[2]);

You are directly converting the strings into Int32. Make sure all of them are actually convertible to integer.


Couple of other observations:
1. I hope ProfileID is an integer as you used in comparison in if statement
2. Not sure why you converted the string array into integers and then back to string concatenation.
Instead of below:
C#
string[] args = e.CommandArgument.ToString().Split(new char[] { ',' });
int pgid = Convert.ToInt32(args[0]);
int pcid = Convert.ToInt32(args[1]);
int psdid = Convert.ToInt32(args[2]);
Server.Transfer("product_title.aspx?pgid='" + pgid + "' & pcid='" + pcid + "'&psdid='" + psdid + "'");

it could have been done as:
C#
string[] args = e.CommandArgument.ToString().Split(new char[] { ',' });
Server.Transfer("product_title.aspx?pgid='" + args[0] + "' & pcid='" + args[1] + "'&psdid='" + args[2] + "'");
 
Share this answer
 

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