Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 29, 2009 09:11 AM by mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
May 28, 2009 06:02 AM|LINK
ArrayList arr = new ArrayList();
arr.Add(TextBox1.Text);
Participant
1182 Points
1697 Posts
May 28, 2009 06:17 AM|LINK
and how to retrieve these value on page load
ob buttonclick
arr.Add(TextBox2.Text);
arr.Add(Dropdownlist.selecteditme.text);
on page load
.....?
thanx
May 28, 2009 06:26 AM|LINK
ArrayList arr = (ArrayList)Session["Data"];
string str1 = arr[0].ToString();
string str2 = arr[1].ToString();
May 28, 2009 06:38 AM|LINK
didnt get yet..
how to assign value to Textbox1
like
TextBox1.text=arr[0].ToString();
..?
May 28, 2009 06:49 AM|LINK
What you dinot get in such a basic thing if I am asigning to string same way assign to a textbox
demoninside9 TextBox1.text=arr[0].ToString();
That's the way to do it
May 28, 2009 07:00 AM|LINK
I didnt mean that,
I am little confused that u didnt use session variable
i did it this way
on buttob click
Session["title"] = ddlTitle.SelectedItem.Text; Session["fname"] = txtFName.Text; Session["lname"] = txtLName.Text; Session["sex"] = RadioButtonList1.SelectedItem.Text; Session["designation"] = txtDesignation.Text; Session["pin"] = txtPin.Text; Session["email"] = txtEmail.Text; Session["mobile"] = txtMobileNo.Text; Session["phone"] = txtPhone.Text; Session["fax"] = txtFaxno.Text;
and on page_load
ddlTitle.SelectedItem.Text = Session["title"].ToString(); txtFName.Text = Session["fname"].ToString(); txtLName.Text = Session["lname"].ToString(); RadioButtonList1.SelectedIndex = RadioButtonList1.Items.IndexOf(RadioButtonList1.Items.FindByText(Session["sex"].ToString())); txtDesignation.Text = Session["designation"].ToString(); txtPin.Text = Session["pin"].ToString(); txtEmail.Text = Session["email"].ToString(); txtMobileNo.Text = Session["mobile"].ToString(); txtPhone.Text = Session["phone"].ToString(); txtFaxno.Text = Session["fax"].ToString();
But in ur code with array there is no use of session ..Sorry if ,may be i m confused..
May 28, 2009 07:10 AM|LINK
Well everytime Its not possible for me to write whole code since we are discussing on session you should relate it with the previous reply
I'll suggest try it first before posting since unless you try you'll always be confused So its better yo try if you get error post you code
May 28, 2009 07:26 AM|LINK
Okie Dear Sorry...
Now OnButtonClick
arr.Add(ddlTitle.SelectedItem.Text); arr.Add(txtFName.Text); arr.Add(txtLName.Text); // arr.Add(RadioButtonList1.SelectedItem.Text); arr.Add(txtPin.Text); arr.Add(txtEmail.Text); arr.Add(txtMobileNo.Text); arr.Add(txtPhone.Text); arr.Add(txtFaxno.Text);
and on_pageload
ddlTitle.SelectedItem.Text = arr[0].ToString(); txtFName.Text = arr[1].ToString(); txtLName.Text = arr[2].ToString(); //RadioButtonList1.SelectedIndex = arr[3].ToString(); txtDesignation.Text = arr[4].ToString(); txtPin.Text = arr[5].ToString(); txtEmail.Text = arr[6].ToString(); txtMobileNo.Text = arr[7].ToString(); txtPhone.Text = arr[8].ToString(); txtFaxno.Text = arr[9].ToString();
It shows error
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
May 28, 2009 07:40 AM|LINK
demoninside9 arr.Add(ddlTitle.SelectedItem.Text); arr.Add(txtFName.Text); arr.Add(txtLName.Text); // arr.Add(RadioButtonList1.SelectedItem.Text); arr.Add(txtPin.Text); arr.Add(txtEmail.Text); arr.Add(txtMobileNo.Text); arr.Add(txtPhone.Text); arr.Add(txtFaxno.Text);
Inserted 7 items
demoninside9 ddlTitle.SelectedItem.Text = arr[0].ToString(); txtFName.Text = arr[1].ToString(); txtLName.Text = arr[2].ToString(); //RadioButtonList1.SelectedIndex = arr[3].ToString(); txtDesignation.Text = arr[4].ToString(); txtPin.Text = arr[5].ToString(); txtEmail.Text = arr[6].ToString(); txtMobileNo.Text = arr[7].ToString(); txtPhone.Text = arr[8].ToString(); txtFaxno.Text = arr[9].ToString();
getting 10 items
What you expect from .net [:|]
May 28, 2009 08:49 AM|LINK
[:O]
Now for page load
ddlTitle.Text = arr[0].ToString(); txtFName.Text = arr[1].ToString(); txtLName.Text = arr[2].ToString(); txtDesignation.Text = arr[3].ToString(); txtEmail.Text = arr[4].ToString(); txtFaxno.Text = arr[5].ToString(); txtMobileNo.Text = arr[6].ToString(); txtPin.Text = arr[7].ToString(); txtPhone.Text = arr[8].ToString();
for button click
arr.Add(txtDesignation.Text); arr.Add(ddlTitle.SelectedItem.Text); arr.Add(txtFName.Text); arr.Add(txtLName.Text); arr.Add(txtPin.Text); arr.Add(txtEmail.Text); arr.Add(txtMobileNo.Text); arr.Add(txtPhone.Text); arr.Add(txtFaxno.Text);
still same problem..
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 28, 2009 06:02 AM|LINK
ArrayList arr = new ArrayList();
arr.Add(TextBox1.Text);
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 28, 2009 06:17 AM|LINK
and how to retrieve these value on page load
ob buttonclick
ArrayList arr = new ArrayList();
arr.Add(TextBox1.Text);
arr.Add(TextBox2.Text);
arr.Add(Dropdownlist.selecteditme.text);
on page load
.....?
thanx
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 28, 2009 06:26 AM|LINK
ArrayList arr = (ArrayList)Session["Data"];
string str1 = arr[0].ToString();
string str2 = arr[1].ToString();
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 28, 2009 06:38 AM|LINK
didnt get yet..
how to assign value to Textbox1
like
TextBox1.text=arr[0].ToString();
..?
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 28, 2009 06:49 AM|LINK
What you dinot get in such a basic thing if I am asigning to string same way assign to a textbox
That's the way to do it
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 28, 2009 07:00 AM|LINK
I didnt mean that,
I am little confused that u didnt use session variable
i did it this way
on buttob click
Session["title"] = ddlTitle.SelectedItem.Text;
Session["fname"] = txtFName.Text;
Session["lname"] = txtLName.Text;
Session["sex"] = RadioButtonList1.SelectedItem.Text;
Session["designation"] = txtDesignation.Text;
Session["pin"] = txtPin.Text;
Session["email"] = txtEmail.Text;
Session["mobile"] = txtMobileNo.Text;
Session["phone"] = txtPhone.Text;
Session["fax"] = txtFaxno.Text;
and on page_load
ddlTitle.SelectedItem.Text = Session["title"].ToString();
txtFName.Text = Session["fname"].ToString();
txtLName.Text = Session["lname"].ToString();
RadioButtonList1.SelectedIndex = RadioButtonList1.Items.IndexOf(RadioButtonList1.Items.FindByText(Session["sex"].ToString()));
txtDesignation.Text = Session["designation"].ToString();
txtPin.Text = Session["pin"].ToString();
txtEmail.Text = Session["email"].ToString();
txtMobileNo.Text = Session["mobile"].ToString();
txtPhone.Text = Session["phone"].ToString();
txtFaxno.Text = Session["fax"].ToString();
But in ur code with array there is no use of session ..Sorry if ,may be i m confused..
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 28, 2009 07:10 AM|LINK
Well everytime Its not possible for me to write whole code since we are discussing on session you should relate it with the previous reply
I'll suggest try it first before posting since unless you try you'll always be confused So its better yo try if you get error post you code
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 28, 2009 07:26 AM|LINK
Okie Dear Sorry...
ArrayList arr = new ArrayList();
Now OnButtonClick
arr.Add(ddlTitle.SelectedItem.Text);
arr.Add(txtFName.Text);
arr.Add(txtLName.Text);
// arr.Add(RadioButtonList1.SelectedItem.Text);
arr.Add(txtPin.Text);
arr.Add(txtEmail.Text);
arr.Add(txtMobileNo.Text);
arr.Add(txtPhone.Text);
arr.Add(txtFaxno.Text);
and on_pageload
ddlTitle.SelectedItem.Text = arr[0].ToString();
txtFName.Text = arr[1].ToString();
txtLName.Text = arr[2].ToString();
//RadioButtonList1.SelectedIndex = arr[3].ToString();
txtDesignation.Text = arr[4].ToString();
txtPin.Text = arr[5].ToString();
txtEmail.Text = arr[6].ToString();
txtMobileNo.Text = arr[7].ToString();
txtPhone.Text = arr[8].ToString();
txtFaxno.Text = arr[9].ToString();
It shows error
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
thanx
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 28, 2009 07:40 AM|LINK
Inserted 7 items
getting 10 items
What you expect from .net [:|]
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 28, 2009 08:49 AM|LINK
[:O]
Now for page load
ddlTitle.Text = arr[0].ToString();
txtFName.Text = arr[1].ToString();
txtLName.Text = arr[2].ToString();
txtDesignation.Text = arr[3].ToString();
txtEmail.Text = arr[4].ToString();
txtFaxno.Text = arr[5].ToString();
txtMobileNo.Text = arr[6].ToString();
txtPin.Text = arr[7].ToString();
txtPhone.Text = arr[8].ToString();
for button click
arr.Add(txtDesignation.Text);
arr.Add(ddlTitle.SelectedItem.Text);
arr.Add(txtFName.Text);
arr.Add(txtLName.Text);
arr.Add(txtPin.Text);
arr.Add(txtEmail.Text);
arr.Add(txtMobileNo.Text);
arr.Add(txtPhone.Text);
arr.Add(txtFaxno.Text);
still same problem..
thanx