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
Nepethya Rana
NA
335
151.9k
Need help to work on dropdownlist when pagepostback
Jun 6 2016 8:19 PM
I have created simple webform with two dropdownlists which get loaded with numbers on page load event. I have add, sub, mul, divide buttons to operate calculation and a label to display result.
When i select two numbers from dropdownlist and hit the buttons, I got 0 as result.
My Code:
protected void Page_Load(object sender, EventArgs e)
{
MyCalculationClient mc = new MyCalculationClient();
DropDownList1.DataSource = mc.DisplayNumbers();
DropDownList1.DataTextField = "Number";
DropDownList1.DataBind();
DropDownList2.DataSource = mc.DisplayNumbers();
DropDownList2.DataTextField = "Number";
DropDownList2.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
int a = Convert.ToInt32(DropDownList1.Text);
int b = Convert.ToInt32(DropDownList2.Text);
MyCalculationClient add = new MyCalculationClient();
Label1.Text = add.Add(a, b).ToString();
}
Reply
Answers (
1
)
problem Kendo UI grid getting data from Dynamics CRM
How can I get the current logged in user name?