일부 Image Button을 my gridview에 넣었지만 클릭 이벤트를 캡처 할 수 없습니다. 클릭 이벤트를 만들거나 그리드 뷰에서 OnRowCommand 핸들러를 만들지 마십시오.asp.net의 gridview에서 단추 클릭을 캡처 할 수 없습니다.
버튼을 클릭하면 현재 페이지로 간단하게 다시 게시됩니다.
나는 이런 식으로 내 버튼을 추가 :
protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string status = DataBinder.Eval(e.Row.DataItem, "visitstatusuid").ToString();
string visitUID = DataBinder.Eval(e.Row.DataItem, "visituid").ToString();
Color backColor = Color.White;
Color foreColor = Color.Black;
ImageButton b;
switch (status)
{
case "U": // Unallocated
backColor = ColorTranslator.FromHtml("#B2A1C7");
b = new ImageButton();
b.Width = Unit.Pixel(25);
b.Height = Unit.Pixel(30);
b.AlternateText = "Book";
b.ImageUrl = "../../Images/New/booking.gif";
b.ToolTip = "Booking";
b.CommandName = "Booking";
b.CommandArgument = visitUID;
b.CausesValidation = false;
e.Row.Cells[(e.Row.Cells.Count - 3)].Controls.Add(b);
등
) 사실, b.Click + new ImageClickEventHandler (gridviewButtonClick)을 시도했지만 중단 점이 발생했지만 중단 점에 도달하지 않습니다. 단추를 클릭하면 – NibblyPig
단추를 클릭하면 다시 게시가 발생합니다. 포스트 백에 단추를 다시 만드시겠습니까? –