国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

在DataGrid中引發驗證 -------Causesvalidation In Datagrid

2024-07-21 02:23:26
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • causesvalidation in datagrid


    在我們對datagrid進行編輯的時候,我們可能要對用戶輸入的數據進行驗證,以確保數據的正確性、完整性。要解決這個問題有很多不同的方法,如:我們可以運用vs.net當中的驗證控件,如: requiredfieldvalidator 。這樣我們便需要 datagrid中的 update 按鈕引發驗證來檢驗用戶輸入的數據是否為空。update 按鈕包含一個causesvalidation 屬性。

    public property causesvalidation() as boolean

    成員屬于: system.web.ui.webcontrols.linkbutton



    摘要:

    獲取或設置一個值,該值指示在單擊 system.web.ui.webcontrols.linkbutton 控件時是否執行驗證。






    我們可以利用這個屬性來自由控制一個webcontrol是否引發驗證。

    datagrid itemdatabound 事件:

    if (e.item.itemtype = listitemtype.edititem) then

    setupdatecommandcausesvalidation(e.item, true)

    end if

    private function setupdatecommandcausesvalidation(byval item as datagriditem, byval valor as boolean) as string

    if (item.hascontrols()) then

    for each celula as control in item.controls

    for each possiblebutton as control in celula.controls

    if (possiblebutton.gettype().name.equals("datagridlinkbutton")) then

    dim lbt as linkbutton = ctype(possiblebutton, linkbutton)

    if (lbt.text.equals(getupdatecolumntext())) then

    lbt.causesvalidation = valor

    exit for

    end if

    end if

    next

    next

    end if

    end function

    private function getupdatecolumntext() as string

    dim text as string = ""

    for each coluna as datagridcolumn in datagrid1.columns

    if (coluna.gettype().name.equals("editcommandcolumn")) then

    dim colunaedit as editcommandcolumn = ctype(coluna, editcommandcolumn)

    text = colunaedit.updatetext

    exit for

    end if

    next

    return text

    end function


    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 平泉县| 美姑县| 新巴尔虎右旗| 贵德县| 商丘市| 天津市| 瑞丽市| 同心县| 曲周县| 武平县| 新宁县| 南投县| 靖江市| 永新县| 岗巴县| 永福县| 定南县| 财经| 渝北区| 资源县| 沈阳市| 海口市| 东明县| 武定县| 大余县| 高邮市| 昭平县| 马边| 临城县| 朝阳市| 安徽省| 清流县| 洛阳市| 伊宁县| 凤冈县| 鄢陵县| 桐乡市| 商南县| 宜宾市| 华安县| 稷山县|