Private void DataGrid1_itemdatabase (Object Sender, System.Web.ui.WebControls.DataGriditeMeventArgs E)
{
Enter the editing tool to limit the width of TextBox
E.Item.cells [4] .attributes.add ("onclick", "Return Confirm ('Do you have 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);} }