Click here to Skip to main content
12,403,811 members (68,317 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
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


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

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
string val1 = Request.QueryString[0];
        string val2 = Request.QueryString[1];
        string val3 = Request.QueryString[2];
Posted 1-Feb-13 18:49pm
Comments
Krunal Rohit 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"
Krunal Rohit 2-Feb-13 2:06am
   
at which line ?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Potential place looks like:
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:
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:
string[] args = e.CommandArgument.ToString().Split(new char[] { ',' });
Server.Transfer("product_title.aspx?pgid='" + args[0] + "' & pcid='" + args[1] + "'&psdid='" + args[2] + "'");
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 2 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100