您现在的位置是:主页 > news > 手机触屏版网站开发/微信小程序开发多少钱
手机触屏版网站开发/微信小程序开发多少钱
admin2025/6/18 22:01:12【news】
简介手机触屏版网站开发,微信小程序开发多少钱,网站建设与管理简单么,多模室内设计网一、控件【简单控件】(一)文字显示1、Label → 在html中相当于span2、Literal → 仅文字 → 一般用来输出JS代码(二)文字输入TextBox → TextMode不同效果不同TextMode :默认是Text单行文本输入框singleLine()密码输入password()多行文本输入motiline()Warp…
一、控件
【简单控件】
(一)文字显示
1、Label → 在html中相当于span
2、Literal → 仅文字 → 一般用来输出JS代码
(二)文字输入
TextBox → TextMode不同效果不同
TextMode :默认是Text
单行文本输入框singleLine()
密码输入password()
多行文本输入motiline()
Warp:自动换行
Enabled:是否启用 相当于html中的disabled是否可见
ReadOnly:只读
Text:相当于value
(三)按钮
1、Button → 默认是html中的Submit(提交按钮) 无普通按钮和刷新按钮,可以直接用input写
OnClientClick:在客户端点击时执行服务器上的代码,字符串属性,里面写JS代码
例:confirm:confirm('真的要删除吗?')默认确定或取消都会刷新页面,可以用if语句控制
text:html中的value
2、ImageButton → 图片按钮 html中type=image
ImageUrl:图片地址
3、LinkButton → 超链接样式的按钮,仅仅是拥有超链接的样式,并无链接
控件的相同属性:
※边框三项:1、BorderColor:边框颜色
2、BorderWidth:边框粗细
3、BorderStyle:边框样式
NotSet:不设置
None:无
Dotted:实心不连接方块
Dashed:四角
Solid:实线
Double:双实线
Groove:下凹效果
Ridge:上凸效果
Inset:效果同groove
Outset:效果同ridge
※Height:高 Width:宽
【复合控件】
DropDownList → select option(html)
显示数据:(写在load里面)
方法1:DataSource
DropDownList1.DataSource = new NationData().Select();//数据源指向
DropDownList1.DataTextField = "NationName";//显示字段绑定
DropDownList1.DataValueField = "NationCode";//隐藏字段绑定
DropDownList1.DataBind();
方法2:Foreach
if (!IsPostBack)
{
List Nlist = newNationData().Select();foreach (Nation n inNlist)
{
ListItem li= newListItem(n.NationName, n.NationCode);if (li.Value == "N003")
{
li.Selected= true;
}
DropDownList1.Items.Add(li);
}
}
取数据:
1、读取一条数据
取出value值 或 text值 DropDownList只能取一条
void Button1_Click(objectsender, EventArgs e)
{string end = "";foreach (ListItem li inRadioButtonList1.Items)
{if(li.Selected)
{
end+= li.Text + "-" + li.Value + ",";
}
}
Label1.Text=end;
}
ListBox → select option(html)
用法同DropDownList
但是可以多选 - SelectionMode
CheckBoxList
用法同DropDownList
RepeatColumns:一行最多显示多少个数据
RepeatDirection:Vetical垂直显示 Horizontal水平显示
RepeatLayout:Table → 用table布局
Flow → 用span布局
UnorderedList → 无序列表
OrderedList → 有序列表
RadioButtonList
用法同DropDownList
RepeatColumns:一行最多显示多少个数据
RepeatDirection:Vetical垂直显示 Horizontal水平显示
RepeatLayout:Table → 用table布局
Flow → 用span布局
UnorderedList → 无序列表
OrderedList → 有序列表
http协议无状态性:
每一次事件提交,都会将页面刷新,刷新就必走Load事件,重复绑定的情况
判断页面是第一次加载,还是由已经加载出来的页面中的某个按钮执行了提交返回回来的
if (!IsPostBack)
load事件中95%的代码都要写在这里面
代码委托添加点击事件:
例:
Button1.Click += Button1_Click;
控件中的 name用于服务端 id用于客户端(js css)使用
二、WebForm的数据库连接方式
※放在App_Code文件夹下
※web没有命名空间
数据库连接同winform:
1.实力类
2.数据连接类和数据访问类写一块
public classUsersData
{
SqlConnection conn= null;
SqlCommand cmd= null;publicUsersData()
{
conn= new SqlConnection("server=.;database=Data0617;user=sa;pwd=123");
cmd=conn.CreateCommand();
}///
///用户验证///
/// 验证的用户名
/// 验证的密码
///
public bool Select(string Uname, stringPwd)
{bool has = false;
cmd.CommandText= "select *from Users where UserName =@a and PassWord=@b";
cmd.Parameters.Clear();
cmd.Parameters.Add("@a", Uname);
cmd.Parameters.Add("@b", Pwd);
conn.Open();
SqlDataReader dr=cmd.ExecuteReader();if(dr.HasRows)
{
has= true;
}
conn.Close();returnhas;
}
}