点击gridview的某一行的任何一个地方,如何能取到点击的是哪一行???
解决方案 »
- 关于C#使用配置文件的问题
- 用3.5sp1开发的winform,用户也必须要安装3.5 sp1?
- radioButton自动执行Click事件的问题
- 在线等,DataSet简单问题
- .Net 2.0 的程序运行时中文输入法怪
- 我在aspx网页工程加入了一个ocx控件,控件名叫test.contrl,我如何在代码里调用啊,请举个代码例子呗
- 如果使sqlcommand在写数据集的DBNull时,根据字段类型自动写入其默认性,如int为0,string为""
- 动态生成了一个下拉列表框,但是SelectedIndexChanged事件不能触发?
- 怎样在vs.net生成可执行文件
- 急问:关于安装程序制作的问题
- Excel版本问题?
- 急!!如何将Graphics画的图象保存到内存中?
如此这般//datagrid的整行选择
private void dg_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
//整行选择
if(e.Button==System.Windows.Forms.MouseButtons.Left)
{
dg.Select(dg.CurrentRowIndex);
tt_id.Text=dg[dg.CurrentCell.RowNumber,0].ToString();
tt_name.Text=dg[dg.CurrentCell.RowNumber,1].ToString();
}
if(dg[dg.CurrentCell].GetType().ToString()=="System.Boolean")
{
if(dg[dg.CurrentCell].ToString()=="True")
{
dg[dg.CurrentCell]=false;
}
else
{
dg[dg.CurrentCell]=true;
}
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["OnClick"] = ClientScript.GetPostBackEventReference(this,"Select$" + e.Row.RowIndex);
e.Row.Style["cursor"] = "hand";
}
}