Код: Выделить всё
// // I tried this with regular onlick but it did not work.
[i]
//
[/i] // I tried this with the onclick command and trigger. (Also without the trigger)
[i]
[/i]
// without this trigger, i kept getting regular post back. With this trigger I get Async but the UI does not update.
// // tried this with the regular click event.
Код: Выделить всё
protected void expandLBtn_Click(object sender, EventArgs e)
{
GridViewRow row = (GridViewRow)((LinkButton)sender).NamingContainer;
HtmlControl FlagAttendanceDetailsCol = (HtmlControl)attendanceDetailsCol.FindControl("attendanceDetailsCol");
UpdatePanel FlagUpdatePanel2 = (UpdatePanel)FlagAttendanceDetailsCol.FindControl("UpdatePanel2");
System.Web.UI.WebControls.Label FlagLabel2 = (System.Web.UI.WebControls.Label)FlagUpdatePanel2.FindControl("Label3");
FlagLabel2.Text="test";
Label2.Text = "New value2";
UpdatePanel2.Update();
}
Код: Выделить всё
if (e.CommandName == "UpdateTextBox")
{
int rowIndex = Convert.ToInt32(e.CommandArgument);
LinkButton FlagExpandLBtn = attendanceGv.Rows[rowIndex].FindControl("expandLBtn") as System.Web.UI.WebControls.LinkButton;
ScriptManager1.RegisterAsyncPostBackControl(FlagExpandLBtn);
// Here, you can retrieve the data associated with the row that contains the clicked button and
// perform any necessary data operations.
System.Web.UI.WebControls.Label txtBox2 = UpdatePanel2.FindControl("Label2") as System.Web.UI.WebControls.Label;
System.Web.UI.WebControls.Label txtBox3 = UpdatePanel2.FindControl("Label3") as System.Web.UI.WebControls.Label;
if (txtBox2 != null)
{
txtBox2.Text = "test2";
// call the Update method on the UpdatePanel
// Label2.Text = "New value"; // Update the TextBox in the other UpdatePanel.
attendanceDetailsCol.Visible = true;
}
if (txtBox3 != null)
{
txtBox3.Text = "test3";
// call the Update method on the UpdatePanel
// Label3.Text = "New value"; // Update the TextBox in the other UpdatePanel.
attendanceDetailsCol.Visible = true;
}
string test = Label2.Text;
string test2 = Label3.Text;
UpdatePanel2.Update();
}
п>
Подробнее здесь: https://stackoverflow.com/questions/758 ... m-gridview
Мобильная версия