📄 systemtools.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// SystemTools 的摘要说明
/// </summary>
public class SystemTools
{
public SystemTools()
{
///
}
public static void SetListBoxItem(ListBox listBox,string sItemValue)
{
int index = 0;
foreach(ListItem item in listBox.Items)
{
///判断值是否相等,并且设置控件的SelectedIndex
if(item.Value.ToLower() == sItemValue.ToLower())
{
listBox.SelectedIndex = index;
break;
}
index++;
}
}
public static void SetListBoxItem(DropDownList listBox,string sItemValue)
{
int index = 0;
foreach(ListItem item in listBox.Items)
{
///判断值是否相等,并且设置控件的SelectedIndex
if(item.Value.ToLower() == sItemValue.ToLower())
{
listBox.SelectedIndex = index;
break;
}
index++;
}
}
public static void SetListBoxItem(ListBox listBox,string sItemValue,bool IsBool)
{
int index = 0;
if(IsBool == true)
{
sItemValue = sItemValue.ToLower() == "true" ? "1" : "0";
}
foreach(ListItem item in listBox.Items)
{
///判断值是否相等,并且设置控件的SelectedIndex
if(item.Value.ToLower() == sItemValue.ToLower())
{
listBox.SelectedIndex = index;
break;
}
index++;
}
}
public static void SetListBoxItem(DropDownList listBox,string sItemValue,bool IsBool)
{
int index = 0;
if(IsBool == true)
{
sItemValue = sItemValue.ToLower() == "true" ? "1" : "0";
}
foreach(ListItem item in listBox.Items)
{
///判断值是否相等,并且设置控件的SelectedIndex
if(item.Value.ToLower() == sItemValue.ToLower())
{
listBox.SelectedIndex = index;
break;
}
index++;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -