我无法更新用户控件中的radgrid。我的ajaxmanager在主体中。
我的usercontol是TaniUC 我设法从usercontol中激活ajaxrequest事件。但我无法更新radgrid。我在我的usercontol中使用TaniEkle(ID)这是一个公共函数,在我的radgrid中添加一行。 它正在添加但不在屏幕上更新。
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;
}
}
答案 0 :(得分:0)
我找到了答案。我写的用户控件的ID是错误的。将它添加到updatecontrol解决了我的问题。
<telerik:AjaxUpdatedControl ControlID="ucpTani" LoadingPanelID="RadAjaxLoadingPanel1" />