如何在asp.net c#中使用if else条件选择组合框值 [英] how to select combobox value with if else condition in asp.net c#

查看:77
本文介绍了如何在asp.net c#中使用if else条件选择组合框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人告诉我如何给combbobox值一个条件,我想给一个条件,如果我从组合框中选择印度,产品费率将是相同的;如果用户选择的国家/地区不在印度,则费用将增加与数量.因此,如何使用组合框选定的值来赋予此条件.

Pls some one tell that how to give a condition to commbobox value, I want to give a condition that if i select india from combobox, rate of product will same and if user select country,thatis out of india, charges will add with amount. so how to give this condition with combobox selected value.

推荐答案

这应该做到-
void ComboBox1_SelectionChanged(对象发送者,SelectionChangedEventArgs e)
{
{
如果(comboBox1.SelectedValue.ToString()!=印度");
{
//添加金额
}
其他
{
//不添加金额
}
}
This should do it -
void ComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
{
if (comboBox1.SelectedValue.ToString()!= "India");
{
//Add amount
}
else
{
//Dont add amount
}
}


使用ComboBox.SelectedValueChanged事件:无论更改的来源如何,均应将其触发.然后,您可以相应地调整币种.
Use the ComboBox.SelectedValueChanged event: Regardless of the source of the change, it should get fired. You can then adjust your currency accordingly.


这篇关于如何在asp.net c#中使用if else条件选择组合框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆