0

I cant manage to update a radgrid which is in a usercontrol. My ajaxmanager is in the mainform.

my usercontol is TaniUC I manage to fire ajaxrequest event from usercontol. But i can not update radgrid. I use TaniEkle(ID) which is a public func in my usercontol,add a row to my radgrid. It is adding but not updating on screen.

Form.aspx

<telerik:RadAjaxManager ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
   runat="server">
   <AjaxSettings>               


       <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
           <UpdatedControls>
              <telerik:AjaxUpdatedControl ControlID="grdHastalar" LoadingPanelID="RadAjaxLoadingPanel1" />
           </UpdatedControls>
       </telerik:AjaxSetting>
      <telerik:AjaxSetting AjaxControlID="grdHastalar" EventName="OnRowClick" >
           <UpdatedControls>
               <telerik:AjaxUpdatedControl ControlID="TaniUC"  LoadingPanelID="RadAjaxLoadingPanel1" />
           </UpdatedControls>
       </AjaxSettings>

Form.aspx.cs

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if(e.Argument=="taniekle")
        {
            int ID = DataReader.GetInt32(Request.Form["grdTanilarDClickedRowIndex"]);
            if (ID > 0)
             {
                 ucpTani.TaniEkle(ID);
             }
            return;
        }

}

TaniUc.ascx.cs (usercontrol)

 private List<HBS_TANI> seciliTanilarList
    {
        get
        {
            return (List<HBS_TANI>)ViewState["seciliTanilarList"];
        }
        set
        {
            ViewState["seciliTanilarList"] = value;
        }
    }
public void TaniEkle(int id)
    {
        var lst = seciliTanilarList.Where(k => k.ICD10_ID == id).ToList();
        if (lst.Count() > 0)
        {
            return;
        }
        else
        {
            HBS_TANI entity = new HBS_TANI();
            entity.TUR_ID = 1;
            entity.STATUS = true;
            bllTakipTani.Add(entity);

            seciliTanilarList.Add(entity);
            grdSeciliTanilar.DataSource = seciliTanilarList;
        }
    }
4

1 回答 1

0

我找到了答案。我写的usercontrol的Id是错误的。将它添加到 updatecontrol 可以解决我的问题。

<telerik:AjaxUpdatedControl ControlID="ucpTani"  LoadingPanelID="RadAjaxLoadingPanel1" />
于 2012-07-21T11:53:04.613 回答