TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
saifullah khan
NA
335
300.6k
To show the values from an array
Aug 7 2011 11:11 AM
i have five dropdowns. currency,pattern,trade, risk and previous. and three lable
what i do is select the currency,pattern,trade and risk from the dropdowns and click on button. it coppies the selected item from currency and save its copy in previous dropdown. also saves the pattern,trade, and risk in differnt arrays. and when i select and item from previous dropdown so it show the pattern,trade, and risk related to that particular item in the lables.but when i do so all the labels show only the values of risk from the arrays. can somebody tells me what is wrong. the code is given below.
string[] _strArr;
string[] pattern;
string[] trade;
string[] risk;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// DropDownList 1 load code here...
}
if (ViewState["stringArr"] == null)
{
pattern = new string[Currency.Items.Count];
trade = new string[Currency.Items.Count];
risk = new string[Currency.Items.Count];
}
else
{
pattern = (string[])ViewState["stringArr"];
trade = (string[])ViewState["stringArr"];
risk = (string[])ViewState["stringArr"];
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if ((Currency.SelectedValue != "") && (!previous.Items.Contains(Currency.SelectedItem)))
{
previous.SelectedIndex = -1;
previous.Items.Add(Currency.SelectedItem);
pattern[previous.SelectedIndex] = Pattern.SelectedItem.ToString();
trade[previous.SelectedIndex] = Trade.SelectedItem.ToString();
risk[previous.SelectedIndex] = Risk.SelectedItem.ToString();
ViewState["stringArr"] = pattern;
ViewState["stringArr"] = trade;
ViewState["stringArr"] = risk;
}
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Text = pattern[previous.SelectedIndex];
labe2.Text = trade[previous.SelectedIndex];
label3.Text = trade[previous.SelectedIndex];
}
thanks in advance
Reply
Answers (
1
)
Show data related to dropdown
ajax