In my form there are several control. that will be ok ,if user dont fill any of these, and after clicking button user fills all controls. That's fine.
i am using this all , because this is the proper way to fill a form starting by name..last name...email.....and so on
but it is not proper if u are choosing a organization or addres first then u fill contact person name.
or may be user select the organization first then fills contact person name.
for this condition i am doing this all.
and didnt get anything yet.
In this
protected void btnOrg_Click1(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(txtDesignation.Text))
{
arr.Add(txtDesignation.Text);
}
else if (!String.IsNullOrEmpty(ddlTitle.SelectedItem.Text))
{
arr.Add(ddlTitle.SelectedItem.Text);
}
else if (!String.IsNullOrEmpty(txtFName.Text))
{
arr.Add(txtFName.Text);
}
else if (!String.IsNullOrEmpty(txtLName.Text))
{
arr.Add(txtLName.Text);
}
else if (!String.IsNullOrEmpty(txtPin.Text))
{
arr.Add(txtPin.Text);
}
else if (!String.IsNullOrEmpty(txtEmail.Text))
{
arr.Add(txtEmail.Text);
}
else if (!String.IsNullOrEmpty(txtMobileNo.Text))
{
arr.Add(txtMobileNo.Text);
}
else if (!String.IsNullOrEmpty(txtPhone.Text))
{
arr.Add(txtFaxno.Text);
}
else
{ may be all control are fill or may not be
i think this condition works when if and if only all controls are filled or all are blank
but that's not necessary.
there may be all filled or may be some or may be even only one control is filled.
Thanx a lot[:)]
It is our choices that show what we truly are, far more than our abilities...
Bur why after click button when I select anoption from radiobutton list in child form it goes back to parent form. and if i wud fill first name in txtFName control then the value goes to email txtEmail control.
that's why i thought this..
by the way thanx [:)]
It is our choices that show what we truly are, far more than our abilities...
These are silly mistakes in your code spend some time coding and verifying you are storing in some variable and assigning wrong variable to wrong textbox If any major exception or error post it in a new thread since already too many replies here
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 29, 2009 05:32 AM|LINK
The first element oin an array starts from 0 and not one hence instead of 1-8 use 0-7
Contact me
demoninside9
Participant
1202 Points
1707 Posts
Re: How to move value from one form to another
May 29, 2009 06:14 AM|LINK
Now i have changed 1-8 to 0-7
ArrayList arr = (ArrayList)Session["arr"];
if (arr != null && arr.Count > 0)
{
txtFName.Text = arr[0].ToString();
txtLName.Text = arr[1].ToString();
txtDesignation.Text = arr[2].ToString();
txtEmail.Text = arr[3].ToString();
txtFaxno.Text = arr[4].ToString();
txtMobileNo.Text = arr[5].ToString();
txtPin.Text = arr[6].ToString();
txtPhone.Text = arr[7].ToString();
}
but it always show error on bolded line.
means where index value is 1
pls help me dear..
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 29, 2009 06:55 AM|LINK
That simply means your array has only one element hence you get that exception
Also here is msdn tutorial on arraylist follow it
http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx
Contact me
demoninside9
Participant
1202 Points
1707 Posts
Re: How to move value from one form to another
May 29, 2009 07:39 AM|LINK
Yes exactly you are absolutely right
let me tell you..
In my form there are several control. that will be ok ,if user dont fill any of these, and after clicking button user fills all controls. That's fine.
i am using this all , because this is the proper way to fill a form starting by name..last name...email.....and so on
but it is not proper if u are choosing a organization or addres first then u fill contact person name.
or may be user select the organization first then fills contact person name. for this condition i am doing this all.
and didnt get anything yet.
In this
protected void btnOrg_Click1(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(txtDesignation.Text))
{
arr.Add(txtDesignation.Text);
}
else if (!String.IsNullOrEmpty(ddlTitle.SelectedItem.Text))
{
arr.Add(ddlTitle.SelectedItem.Text);
}
else if (!String.IsNullOrEmpty(txtFName.Text))
{
arr.Add(txtFName.Text);
}
else if (!String.IsNullOrEmpty(txtLName.Text))
{
arr.Add(txtLName.Text);
}
else if (!String.IsNullOrEmpty(txtPin.Text))
{
arr.Add(txtPin.Text);
}
else if (!String.IsNullOrEmpty(txtEmail.Text))
{
arr.Add(txtEmail.Text);
}
else if (!String.IsNullOrEmpty(txtMobileNo.Text))
{
arr.Add(txtMobileNo.Text);
}
else if (!String.IsNullOrEmpty(txtPhone.Text))
{
arr.Add(txtFaxno.Text);
}
else
{
may be all control are fill or may not be
i think this condition works when if and if only all controls are filled or all are blank
but that's not necessary.
there may be all filled or may be some or may be even only one control is filled.
Thanx a lot[:)]
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 29, 2009 07:51 AM|LINK
Remive all these conditions and add it that's all I can say
Contact me
demoninside9
Participant
1202 Points
1707 Posts
Re: How to move value from one form to another
May 29, 2009 08:03 AM|LINK
Thanx dear
just a small question
txtFName.Text = arr[0].ToString();
txtLName.Text = arr[1].ToString();
txtDesignation.Text = arr[2].ToString();
txtEmail.Text = arr[3].ToString();
txtFaxno.Text = arr[4].ToString();
txtMobileNo.Text = arr[5].ToString();
txtPin.Text = arr[6].ToString();
txtPhone.Text = arr[7].ToString();
in this, Does it matter if I rearrange the numbers in which order these controls in from.
means
txtFName.Text = arr[7].ToString();
txtLName.Text = arr[6].ToString();
txtDesignation.Text = arr[5].ToString();
txtEmail.Text = arr[4].ToString();
txtFaxno.Text = arr3].ToString();
txtMobileNo.Text = arr[2].ToString();
txtPin.Text = arr[0].ToString();
txtPhone.Text = arr[1].ToString();
they both block are same....or not..?
why this question because when i fill First name text box after clicking button it goes to last name textbox.
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 29, 2009 08:56 AM|LINK
does not matter place it anywhere in any order
Contact me
demoninside9
Participant
1202 Points
1707 Posts
Re: How to move value from one form to another
May 29, 2009 09:04 AM|LINK
Bur why after click button when I select anoption from radiobutton list in child form it goes back to parent form. and if i wud fill first name in txtFName control then the value goes to email txtEmail control.
that's why i thought this..
by the way thanx [:)]
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 29, 2009 09:11 AM|LINK
Well I should ask? What you think ?
These are silly mistakes in your code spend some time coding and verifying you are storing in some variable and assigning wrong variable to wrong textbox If any major exception or error post it in a new thread since already too many replies here
Contact me