protected void gvData_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
ImageButton ibTrue = (ImageButton)e.Row.FindControl("imgButtonTrue");
if (ibTrue != null) ScriptManager.GetCurrent(this.Page).RegisterAsyncPostBackControl(ibTrue);
ImageButton ibFalse = (ImageButton)e.Row.FindControl("imgButtonFalse");
if (ibFalse != null) ScriptManager.GetCurrent(this.Page).RegisterAsyncPostBackControl(ibFalse);
}
}
asdf
Tampilkan postingan dengan label GridView. Tampilkan semua postingan
Tampilkan postingan dengan label GridView. Tampilkan semua postingan
Trigger UpdatePanel From ImageButton in GridView
Get Only Current Page Data From ASP.NET Gridview
Sometimes we want to get current page data from gridview. In my case, I want to update current view data as read. Here is the code:
private void UpdateAsRead()
{
//get header
foreach (DataControlField col in gvForm.Columns)
{
//Response.Write(col.HeaderText);
}
//get data
foreach (GridViewRow row in gvForm.Rows)
{
int i = 1;
foreach (TableCell cell in row.Cells)
{
//get all rows
if (i == 1)
{
GeneralDao gen = new GeneralDao();
//Response.Write(cell.Text + "
");
string strSQL = @"UPDATE TMIForm SET ldate ='" + gen.GetDateTime() + @"', luserid='" + GetUsername + @"'
WHERE id = '" + cell.Text + @"'";
frmDao.Update(strSQL);
}
i += i;
if (i == 7) { i = 1; }
}
}
}
[Read more]
private void UpdateAsRead()
{
//get header
foreach (DataControlField col in gvForm.Columns)
{
//Response.Write(col.HeaderText);
}
//get data
foreach (GridViewRow row in gvForm.Rows)
{
int i = 1;
foreach (TableCell cell in row.Cells)
{
//get all rows
if (i == 1)
{
GeneralDao gen = new GeneralDao();
//Response.Write(cell.Text + "
");
string strSQL = @"UPDATE TMIForm SET ldate ='" + gen.GetDateTime() + @"', luserid='" + GetUsername + @"'
WHERE id = '" + cell.Text + @"'";
frmDao.Update(strSQL);
}
i += i;
if (i == 7) { i = 1; }
}
}
}
GridView Colum Filter Via Code
GridView1.ActiveFilterString = "[Category] = 3 AND [Discontinued] = false"
Select grid view row by code, programatically filter row devexpress grid view
[Read more]
Select grid view row by code, programatically filter row devexpress grid view