This is a migrated thread and some comments may be shown as answers.

Page Parameter

2 Answers 69 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Nikola
Top achievements
Rank 2
Nikola asked on 21 Nov 2012, 09:47 AM
heey 

I have 3 different RadComboBoxs in one page and the 3 RadComboboxes in another page is it somehow possible to transfer the selected values from the first three Comboboxes to the other Comboboxes (Maybe via URL Javascript ) ?

if you need my code just ask

Thanks for help and fast answer

2 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 23 Nov 2012, 12:54 PM
Hello,

When a form containing the fields (field1, field2, field3) is submitted, the content of the fields is encoded as a query string as follows: field1=value1&field2=value2&field3=value3...
So in your case you should pass the parameters as follows: 
Response.Redirect("QStringTest.aspx?ComboBox1=" + value1 + "&ComboBox2=" + value2 +"&ComboBox3=" + value3 ).

And retrieve them as follows:
protected void Page_Load(object sender, EventArgs e)
{
    RadComboBox1.Text = Request.QueryString["ComboBox1"];
    RadComboBox2.Text = Request.QueryString["ComboBox2"];
    RadComboBox3.Text = Request.QueryString["ComboBox3"];
}


Kind regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Nikola
Top achievements
Rank 2
answered on 23 Nov 2012, 01:29 PM
heey 

But sry after some days i got it by myself,and your solution is really  bad .... 
 
I thing that that one better 

Frist Page code behind 
Response.Redirect("~/Report/MonthYearReport.aspx?id1=" + rcbLocationBusinessUnits.SelectedValue + "&id2=" + rcbBusinessUnits.SelectedValue+"&id3="+rcbDepartments.SelectedValue );

Second Page  code behind  

string cmb1Value = Request.QueryString["id1"].ToString();
string cmb2Value = Request.QueryString["id2"].ToString();
string cmb3Value = Request.QueryString["id3"].ToString();
 
int index1 = -1;
index1 = rcbLocationBusinessUnits.FindItemIndexByValue(cmb1Value);
rcbLocationBusinessUnits.SelectedValue = cmb1Value;
 
int index2 = -1;
index2 = rcbBusinessUnits.FindItemIndexByValue(cmb2Value);
rcbBusinessUnits.SelectedValue = cmb2Value;
 
int index3 = -1;
index3 = rcbDepartment.FindItemIndexByValue(cmb3Value);
rcbDepartment.SelectedValue = cmb3Value;
 
 
if (!Page.IsPostBack)
{
    LoadYear();
    LoadMonth();
    LoadLBU();
    if (index2 > -1)
    {
        LoadBU(index1.ToString());
    }
    if (index3 > -1)
    {
        LoadDep(index2.ToString());
    }
 
 
}

 
Tags
Ajax
Asked by
Nikola
Top achievements
Rank 2
Answers by
Kostadin
Telerik team
Nikola
Top achievements
Rank 2
Share this question
or