将DataGridView某列设置为DataGridViewLinkColumn? DataGridView的单元格默认是TextBox,那么我如何将某列的样式设置为DataGridViewLinColumn呢?我是用DataTable绑定DataGridView来显示数据库数据的,目前有一列值取得是false,那么我就给它一个超链接,让它能够接受单击事件,否则则不显示超链接,请问这应该怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 设置属性Visible = '<%# DataBinder.Eval(Container.DataItem, "你的相应的字段") %>' 您能说的具体点吗?我的程序不是.NET是Winform 我的问题不是在是否现实某个是不是超链接,而是整个列怎么让它先显示为超链接public static DataTable GetDataTable(){DataTable dataTable = new DataTable(); dataTable.Locale = CultureInfo.InvariantCulture; dataTable.Columns.Add("Column1", typeof(string)); dataTable.Columns.Add("Column2", typeof(string)); dataTable.Columns.Add("Column3", typeof(string)); if (tempDataSet != null && tempDataSet.Tables[0].Rows.Count > 0) { for (int i = rows; i < rows + length; i++) { DataRow row = tempDataSet.Tables[0].Rows[i]; DataRow TableRow = dataTable.NewRow(); TableRow["Column1"] = Convert.ToDateTime(row["StartTime"]).ToString(); TableRow["Column2"] = row["SubjectName"].ToString(); TableRow["Column3"] = row["StudentName"].ToString();//这个列的文本显示为超链接 dataTable.Rows.Add(TableRow); } return dataTable; } return null;}///在Panel上的DataGridView上显示数据库数据private void DisplayDataGridView(){DataTable dataTable = GetDataTable();if (dataTable != null && dataTable.Rows.Count > 0) { this.dataGridView1.Columns[0].DataPropertyName = "Column1"; this.dataGridView1.Columns[1].DataPropertyName = "Column2"; ///如何让这个列的样式变为超链接DataGridViewLinkColumn this.dataGridView1.Columns[2].DataPropertyName = "Column3"; this.bindingSource.DataSource = dataTable; this.bindingNavigator.BindingSource = bindingSource; this.dataGridView1.DataSource = bindingSource; }} 使用FileUpload 控件上传东西时出错,但是不提示错误。我复制了别的项目的web.config,就提示错误,并且运行能成功。 C#.net动态生成checkbox 程序中过多使用静态变量有何不妥? 急,急,时间格式转换精确到毫秒怎么做?? Repeater怎么为图片地址绑定数据库查出来的路径 c# 下载 请问怎么用C#函数读本机的机器码? 怎么样在windows forms中获得Datagrid的子控件 为什么object.Tostring()会出错呢? 能不能单独安装Visual C#? 求助……关于补丁程序 关于event的browsable
public static DataTable GetDataTable()
{
DataTable dataTable = new DataTable();
dataTable.Locale = CultureInfo.InvariantCulture;
dataTable.Columns.Add("Column1", typeof(string));
dataTable.Columns.Add("Column2", typeof(string));
dataTable.Columns.Add("Column3", typeof(string)); if (tempDataSet != null && tempDataSet.Tables[0].Rows.Count > 0)
{
for (int i = rows; i < rows + length; i++)
{
DataRow row = tempDataSet.Tables[0].Rows[i];
DataRow TableRow = dataTable.NewRow();
TableRow["Column1"] = Convert.ToDateTime(row["StartTime"]).ToString();
TableRow["Column2"] = row["SubjectName"].ToString();
TableRow["Column3"] = row["StudentName"].ToString();//这个列的文本显示为超链接 dataTable.Rows.Add(TableRow);
} return dataTable;
} return null;
}///在Panel上的DataGridView上显示数据库数据
private void DisplayDataGridView()
{
DataTable dataTable = GetDataTable();
if (dataTable != null && dataTable.Rows.Count > 0)
{
this.dataGridView1.Columns[0].DataPropertyName = "Column1";
this.dataGridView1.Columns[1].DataPropertyName = "Column2"; ///如何让这个列的样式变为超链接DataGridViewLinkColumn
this.dataGridView1.Columns[2].DataPropertyName = "Column3"; this.bindingSource.DataSource = dataTable;
this.bindingNavigator.BindingSource = bindingSource;
this.dataGridView1.DataSource = bindingSource;
}
}