DataGrid Delete dialog editing mode again TextBox & limit length private void DataGrid1_ItemDataBound (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {try to enter the edit mode limits the TextBox width e.Item.Cells [4] .Attributes.Add ("Onclick", "Return Confirm ('Do you make sure you want to delete this?');");
IF (E.Item.itemType == ListItemType.editItem) {if (E.Item.controls [1] .controls [0] .gettype (). Tostring () == "System.Web.ui.WebControls.TextBox" ) {TextBox TB = (TextBox) E.Item.controls [1] .controls [0]; tb.width = unit.parse ("80px"); tb.cssclass = "textbox"; tb.text = Server.htmldecode (tb.text);} if (E.Item.controls [2] .controls [0] .gettype (). Tostring () == "system.web.ui.webcontrols.textbox") {textbox TB = (TextBox ) E.Item.controls [2] .controls [0]; tb.width = unit.parse ("250px"); tb.cssclass = "textbox"; tb.text = server.htmldecode (tb.text);} }