1.

Solve : checkbox problem! need help?

Answer»

I have USE 4 checkbox in one asp.net webpage, say page

1. language used is in c# in visual studio.net 2008.
I want to pass the VALUE of these checkbox to another

asp.net page ,say page 2.
 Its not working.Please correct the code. Here are the

codes.

On page 1.aspx.cs
---------------------
PROTECTED void Button2_Click(object sender, EventArgs e)
{
   string Rating1 = CheckBox1.Checked;
   string Rating2 = CheckBox1.Checked;
   string Rating3 = CheckBox1.Checked;
   string Rating4 = CheckBox1.Checked;
   
   string url;

 if (CheckBox1.Checked)
        { Rating1 = "Best"; }
       
           if (CheckBox2.Checked)
        { Rating2 = "Good"; }
       
                if (CheckBox3.Checked)
        { Rating3 = "Average"; }
       
         if (CheckBox4.Checked)
        { Rating4 = "Not Satisfactory"; }

url = "page2.aspx?RAT1="  + Rating1+ "&rat2=" + Rating2

+ "&rat3=" + Rating3 + "&rat4=" + Rating4 ;
        Response.Redirect(url);

on page2.aspx.cs
----------------------
PUBLIC partial class _Default : System.Web.UI.Page
{
   string RetrievedValue4;
    string RetrievedValue5;
    string RetrievedValue6;
    string RetrievedValue7;
    string RetrievedValue8;

protected void Page_Load(object sender, EventArgs e)
    {
        this.Label14.Text = Request.QueryString["rat1"];
        RetrievedValue5 = this.Label14.Text;


        this.Label15.Text = Request.QueryString["rat2"];
        RetrievedValue6 = this.Label15.Text;

        this.Label16.Text = Request.QueryString["rat3"];
        RetrievedValue7 = this.Label16.Text;

        this.Label17.Text = Request.QueryString["rat4"];
        RetrievedValue8 = this.Label17.Text;
     }


Thanks
God bless you!!



Discussion

No Comment Found