Tag: gridview

在按钮单击时获取行的DataKeyNames

我有一个gridview,每行有按钮: 按钮位于模板字段中: … 如何在点击时获取数据密钥名称? protected void viewHoursButton_OnClick(object sender, EventArgs e) { //get PK_NonScrumStory for clicked row }

如何在gridview中创建类型密码列?

我正在创建一个应用程序,用户在其中选择文件并提供打开该文件的凭据。 为此,我在gridview中创建了三列。 用户在密码栏中输入密码。 我想显示*代替字符,就像我们可以创建一个密码类型的文本框。 我在GridView_CellClick事件上尝试了这段代码: if (GridView.Columns[e.ColumnIndex].HeaderText == “Password”) { txtPassword[e.RowIndex] = new TextBox(); txtPassword[e.RowIndex].Name = “txtPassword”+e.RowIndex; txtPassword[e.RowIndex].PasswordChar = ‘*’; txtPassword[e.RowIndex].Visible = true; txtPassword[e.RowIndex].TextChanged += new if (GridView.CurrentCell.Value == null) txtPassword[e.RowIndex].Text = “”; else txtPassword[e.RowIndex].Text = GridView.CurrentCell.Value.ToString(); txtPassword[e.RowIndex].Location = GridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex + 1, false).Location; txtPassword[e.RowIndex].Size = GridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex + 1, false).Size; txtPassword[e.RowIndex].Visible = true; txtPassword[e.RowIndex].Focus(); […]

按钮单击行时,在C#Gridview中获取单元格值

我有一个gridviewMain。 每当我单击第1行的CLOSE linkbutton时,我想获得值aa。 单击第2行上的关闭获取bb的值。 有任何想法吗。 ABC aa xx 3 CLOSE bb yy 4 CLOSE cc zz 5 CLOSE ASPX

在gridview中上传文件

我需要将一个带有文件上传控件的列添加到我的网格视图中,以便我可以针对任何特定行上传文件。 是否可以这样做,理想情况下我需要能够在不将gridview置于其编辑状态的情况下执行此操作。

ASP.NET在模板字段中的Gridview单元格中更改文本和颜色

我在ASP.net中有Gridview显示数据。 根据数据,它会根据单元格的值更改颜色和文本。 当列不是模板字段时,这可以正常工作。 //WORKS WHEN IS NOT A TEMPLATE FIELD if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[2].Text == “1”) { e.Row.Cells[2].Text = “IN”; e.Row.Cells[2].BackColor = Color.Blue; e.Row.Cells[2].ForeColor = Color.White; } } 现在我将Column转换为Template字段,但没有任何效果。 //DOEST NOT WORK WHEN IS a TEMPLATE FIELD if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[2].Text == “1”) { e.Row.Cells[2].Text = “IN”; e.Row.Cells[2].BackColor = […]

如何在Windows 8中显示宽度可变的Gridview项目?

我的GridView项目的大小是它的first item size 。 我该如何改变这种行为? 如何根据内容显示具有可变Width GridView items ? 我想展示第一个,但我得到第二个。 有什么建议吗?

获取GridView行的单元格值

我使用GridView – AutoGenerateSelectButton = “True”来选择行以获取Column 1单元格值。 我试过了: GridViewRow row = dgCustomer.SelectedRow; TextBox1.Text = “Cell Value” + row.Cells[1].Text + “”; 它写了“细胞价值”,但没有别的。 我终于能够得到行数(索引)而不是单元格值。 GridViewRow row = dgCustomer.SelectedRow; TextBox1.Text = row.RowIndex.ToString(); 我试过了: TextBox1.Text = dgCustomer.Rows[row.RowIndex].Cells[1].Text; 并仍然返回索引行。 还有其他建议吗? 谢谢!

将行添加到网格视图

是否可以以编程方式在C#ASP中向GridView添加行? 如果有,怎么样? 我想直接从代码添加静态数据,而不是从数组或数据源添加静态数据

所选索引中网格中文本框的Asp.Net更改值已更改

我有这个网格,我动态添加控件。 现在我想更改产品选择索引更改事件的成本价格和销售价格的相应值。 问题是我无法获得具体的行。 在我到目前为止的代码下面。 Total Journal Cost: 而我的代码背后是 #region Private Functions private void FirstGridViewRow() { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn(“RowNumber”, typeof(string))); dt.Columns.Add(new DataColumn(“Products”, typeof(string))); dt.Columns.Add(new DataColumn(“CostPrice”, typeof(string))); dt.Columns.Add(new DataColumn(“SalePrice”, typeof(string))); dt.Columns.Add(new DataColumn(“TotalUnits”, typeof(string))); dt.Columns.Add(new DataColumn(“TotalCost”, typeof(string))); dr = dt.NewRow(); dr[“RowNumber”] = 1; dr[“Products”] = string.Empty; dr[“CostPrice”] = string.Empty; dr[“SalePrice”] […]

获取GridView中所选行的索引

我想从gridview中选择的行使用复选框。 复选框是这样的! 我想要一个每行中的列。 怎么做。谢谢!