个人使用控件点滴
2004-09-17 20:23
288 查看
1,DataGrid中Button 控件的单击,先响应Click,后Command 事件。通过e.CommandName;判断哪个按钮
加入模版列的按钮会将其click事件反升到DataGrid1_ItemCommand事件 2,TextBox1 类似“搜索”,回车执行: AutoPostBack="True"在TextBox1_TextChanged()事件中作处理
2,多个TextBox 或 Button 响应同一事件:修改事件名:this.TextBox1.TextChanged += new System.EventHandler(TextChanged); this.TextBox2.TextChanged += new System.EventHandler(TextChanged); 定义: private void TextChanged(object sender, System.EventArgs e)
{ //区分控件的方法
string id=((TextBox)sender).ID;
//string b=((Button)sender).CommandName; switch(id) { }
} TextBox的Wrap属性,决定是否自动换行。 3,ImageButton1可以作为图像地图使用, private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
int a=e.X;
int b=e.Y; //可以得到鼠标点击的位置,执行不同的操作。
} AlternateText属性,是无法取得图片时的替代文本。 同样可以使用 onmouseover="b()" onmouseout="h()" 动态改变外观。 4,HyperLink 控件文本链接:text图片链接:ImageUrl若同时设置时,ImageUrl,具有较高的优先权,此时,text作为提示文本出现。 5,在客户端javascript里操作服务端控件:this.Button1.Attributes.Add("onclick","return upchang();"); function upchang()
{
var i=document.Form1.all['ListBox1'].selectedIndex;
if(i>0)
{
var val=document.Form1.all['ListBox1'].item(i-1).value;
var txt=document.Form1.all['ListBox1'].item(i-1).text; document.Form1.all['ListBox1'].item(i-1).value=document.Form1.all['ListBox1'].item(i).value;
document.Form1.all['ListBox1'].item(i-1).text=document.Form1.all['ListBox1'].item(i).text; document.Form1.all['ListBox1'].item(i).value=val;
document.Form1.all['ListBox1'].item(i).text=txt; document.Form1.all['ListBox1'].selectedIndex=i-1;
}
}
加入模版列的按钮会将其click事件反升到DataGrid1_ItemCommand事件 2,TextBox1 类似“搜索”,回车执行: AutoPostBack="True"在TextBox1_TextChanged()事件中作处理
2,多个TextBox 或 Button 响应同一事件:修改事件名:this.TextBox1.TextChanged += new System.EventHandler(TextChanged); this.TextBox2.TextChanged += new System.EventHandler(TextChanged); 定义: private void TextChanged(object sender, System.EventArgs e)
{ //区分控件的方法
string id=((TextBox)sender).ID;
//string b=((Button)sender).CommandName; switch(id) { }
} TextBox的Wrap属性,决定是否自动换行。 3,ImageButton1可以作为图像地图使用, private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
int a=e.X;
int b=e.Y; //可以得到鼠标点击的位置,执行不同的操作。
} AlternateText属性,是无法取得图片时的替代文本。 同样可以使用 onmouseover="b()" onmouseout="h()" 动态改变外观。 4,HyperLink 控件文本链接:text图片链接:ImageUrl若同时设置时,ImageUrl,具有较高的优先权,此时,text作为提示文本出现。 5,在客户端javascript里操作服务端控件:this.Button1.Attributes.Add("onclick","return upchang();"); function upchang()
{
var i=document.Form1.all['ListBox1'].selectedIndex;
if(i>0)
{
var val=document.Form1.all['ListBox1'].item(i-1).value;
var txt=document.Form1.all['ListBox1'].item(i-1).text; document.Form1.all['ListBox1'].item(i-1).value=document.Form1.all['ListBox1'].item(i).value;
document.Form1.all['ListBox1'].item(i-1).text=document.Form1.all['ListBox1'].item(i).text; document.Form1.all['ListBox1'].item(i).value=val;
document.Form1.all['ListBox1'].item(i).text=txt; document.Form1.all['ListBox1'].selectedIndex=i-1;
}
}
相关文章推荐
- 个人使用控件点滴
- 使用Gallery控件实现个人相簿功能
- MSFlexGrid控件使用点滴记录
- 使用用户控件和定制的Web部件个人化你的门户网站
- 个人收集的Dev控件使用方法
- (转)ASP.NET 2.0:使用用户控件和定制的Web部件个人化你的门户网站(一)
- delphi学习点滴——操作excel的几个控件使用说明
- 使用Kotlin仿的简书个人主页,只需一个控件
- 使用用户控件和定制的Web部件个人化你的门户网站
- (转) ASP.NET 2.0:使用用户控件和定制的Web部件个人化你的门户网站(二)
- 转:ASP.NET 2.0:使用用户控件和定制的Web部件个人化你的门户网站
- NTKO控件使用总结——个人观点总结
- 使用用户控件和定制的Web部件个人化你的门户网站
- VC编程技术点滴(六)使用ListControl控件显示数据表
- .NET 使用GridView控件绑定数据源个人出现的错误*
- 我个人认为这个不错------使用ASP.NET2.0的TreeView控件显示分层数据
- 【C#】对于ListView控件使用的个人心得
- DataGridView 控件使用点滴
- 关于ListView控件使用的个人总结--以一个简单的新闻客户端开发为例