DataGrid Delete Dialog & Limits Editing Try TETBOX Length [http:www.cnblogs.commatrix]

xiaoxiao2021-03-06  108

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);} }

转载请注明原文地址:https://www.9cbs.com/read-102440.html

New Post(0)