簡體   English   中英

如何在“添加新”模式下打開預填默認值的Telerik RadGrid?

[英]How do I open a Telerik RadGrid in “Add New” mode with default values pre-filled?

從超鏈接中,我需要在“添加新”模式下打開RadGrid彈出窗口時顯示默認值。 單擊RadButton( CommandName="InitInsert" )時,它可以正常工作。 為此,我在RadGrid_ItemCommand設置了默認值:

if (e.CommandName == RadGrid.InitInsertCommandName)
{
    e.Canceled = true; 
    Hashtable values = GetDefaultValues();
    e.Item.OwnerTableView.InsertItem(values); 
}

MasterTableViewMasterTableView具有EditMode="PopUp" 為了使PopUp從鏈接中顯示,我在queryString傳遞了文本“ AddNew”。 然后在PageLoad我設置RadGrid.MasterTableView.IsItemInserted = true; 如此處所述 我不知道如何使默認值顯示在通過超鏈接觸發的PopUp中? 代碼示例將不勝感激。

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if(e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        if(e.Item is GridEditFormItem)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            TextBox TextBox1 = (TextBox)item.FindControl("TextBox1");
            TextBox1.Text = item["column"].Text;
        }
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM