asp.net - radgrid data disappear after filtering -
i using radgrid show data , have set allowfilteringbycolumn true, when try filter rows, postback occurs , radgrid content disappears (all things disappear , border remains).
<telerik:radajaxpanel id="pnlshowgrid" runat="server" loadingpanelid="radajaxloadingpanel4"> <div class="row-fluid"> <telerik:radgrid id="radgrid1" runat="server" cssclass="radgrid" height="400px" clientsettings-selecting-allowrowselect="true" allowpaging="true" pagesize="20" allowsorting="true" autogeneratecolumns="false" allowautomaticupdates="true" showstatusbar="true" allowautomaticdeletes="true" allowfilteringbycolumn="true" width="100%" onupdatecommand="radgrid1_updatecommand" onitemdeleted="rgrd_edit_itemdeleted" onitemcommand="radgrid1_itemcommand"> <exportsettings exportonlydata="true"> <pdf defaultfontfamily="arial unicode ms" fonttype="embed" /> <excel autofitimages="true" /> </exportsettings> <filtermenu enableimagesprites="true"> </filtermenu> <exportsettings exportonlydata="true" openinnewwindow="true"> <excel format="excelml"></excel> <excel autofitimages="true" /> <pdf fonttype="embed" allowprinting="true" /> <pdf defaultfontfamily="arial unicode ms" /> </exportsettings> <clientsettings allowgroupexpandcollapse="true" selecting-allowrowselect="true"> <selecting allowrowselect="true" /> </clientsettings> <mastertableview commanditemdisplay="topandbottom" dir="rtl" allowfilteringbycolumn="true" datakeynames="accesspesrmission_id" nodetailrecordstext="??? ?????? ???? ????? !" nomasterrecordstext="??? ?????? ???? ????? !"> <commanditemsettings exporttopdftext="export pdf" addnewrecordtext="????? ????? ????" showaddnewrecordbutton="false" refreshtext="?????????" showexporttoexcelbutton="true" showexporttowordbutton="true" showexporttopdfbutton="false"> </commanditemsettings> <rowindicatorcolumn filtercontrolalttext="filter rowindicator column" filtercontrolwidth="20%"></rowindicatorcolumn> <expandcollapsecolumn visible="true" filtercontrolalttext="filter expandcolumn column" filtercontrolwidth="20%"></expandcollapsecolumn> <columns> <telerik:gridboundcolumn display="false" filtercontrolwidth="10px" datafield="accesspesrmission_id" datatype="system.int32" filtercontrolalttext="filter accesspesrmission_id column" headertext="?????" sortexpression="accesspesrmission_id" uniquename="accesspesrmission_id" andcurrentfilterfunction="contains" autopostbackonfilter="true" currentfilterfunction="contains"> </telerik:gridboundcolumn> <telerik:gridcheckboxcolumn datafield="accesspermission_read" datatype="system.boolean" filtercontrolalttext="filter accesspermission_read column" headertext="?????" sortexpression="accesspermission_read" uniquename="accesspermission_read" andcurrentfilterfunction="contains" autopostbackonfilter="true" currentfilterfunction="contains"> </telerik:gridcheckboxcolumn> <telerik:gridcheckboxcolumn datafield="accesspermission_add" datatype="system.boolean" filtercontrolalttext="filter accesspermission_add column" headertext="???" sortexpression="accesspermission_add" uniquename="accesspermission_add"> </telerik:gridcheckboxcolumn> <telerik:gridcheckboxcolumn datafield="accesspermission_edit" datatype="system.boolean" filtercontrolalttext="filter accesspermission_edit column" headertext="??????" sortexpression="accesspermission_edit" uniquename="accesspermission_edit"> </telerik:gridcheckboxcolumn> <telerik:gridcheckboxcolumn datafield="accesspermission_delete" datatype="system.boolean" filtercontrolalttext="filter accesspermission_delete column" headertext="???" sortexpression="accesspermission_delete" uniquename="accesspermission_delete"> </telerik:gridcheckboxcolumn> <telerik:gridboundcolumn display="false" filtercontrolwidth="10px" datafield="accesspesrmission_sathesazmani_id" filtercontrolalttext="filter accesspesrmission_sathesazmani_id column" headertext="????? ??? ???????" sortexpression="accesspesrmission_sathesazmani_id" uniquename="accesspesrmission_sathesazmani_id" andcurrentfilterfunction="contains" autopostbackonfilter="true" currentfilterfunction="contains"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="40px" datafield="vahedsazmani_farsiname" filtercontrolalttext="filter vahedsazmani_farsiname column" headertext="???? ???????" sortexpression="vahedsazmani_farsiname" uniquename="vahedsazmani_farsiname"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="40px" datafield="semat_name" filtercontrolalttext="filter semat_name column" headertext="???" sortexpression="semat_name" uniquename="semat_name"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="40px" datafield="groohekarmandi_namefarsi" filtercontrolalttext="filter groohekarmandi_namefarsi column" headertext="???? ???????" sortexpression="groohekarmandi_namefarsi" uniquename="groohekarmandi_namefarsi"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="40px" datafield="personel_namekamel" filtercontrolalttext="filter personel_namekamel column" headertext="?????" sortexpression="personel_namekamel" uniquename="personel_namekamel"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="40px" datafield="com_name" filtercontrolalttext="filter com_name column" headertext="????" sortexpression="com_name" uniquename="com_name"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="70px" datafield="source_desc" filtercontrolalttext="filter source_desc column" headertext="????" sortexpression="source_desc" uniquename="source_desc"> </telerik:gridboundcolumn> <telerik:gridboundcolumn filtercontrolwidth="20px" datafield="sourcetype_desc" filtercontrolalttext="filter sourcetype_desc column" headertext="??? ????" sortexpression="sourcetype_desc" uniquename="sourcetype_desc"> </telerik:gridboundcolumn> <telerik:gridbuttoncolumn commandname="delete" buttontype="imagebutton" text="???" uniquename="columndelete" confirmtext="??? ?? ?????? ????? ???? ??? ?? ??? ???? ?" confirmdialogtype="radwindow" imageurl="../../assets/img/icon/del-layer.png" confirmdialogheight="180" confirmdialogwidth="380" footerstyle-width="60px" headerstyle-width="60px" itemstyle-width="60px"> </telerik:gridbuttoncolumn> <telerik:gridbuttoncolumn commandname="edit" andcurrentfilterfunction="contains" buttontype="imagebutton" imageurl="../../assets/img/icon/edit.png" autopostbackonfilter="true" currentfilterfunction="contains" text="??????" footerstyle-width="60px" headerstyle-width="60px" itemstyle-width="60px" uniquename="columnedit"> </telerik:gridbuttoncolumn> </columns> <editformsettings insertcaption="????? ????? ????" captionformatstring="?????? ???? ?? ?? : {0}" captiondatafield="com_id" editformtype="template" popupsettings-modal="true" formtablestyle-horizontalalign="center" formcaptionstyle-horizontalalign="center" popupsettings-closebuttontooltip="????" usercontrolname="popupform" popupsettings-width="800"> <editcolumn uniquename="editcommandcolumn1" filtercontrolalttext="filter editcommandcolumn1 column"></editcolumn> <formtablestyle horizontalalign="center"></formtablestyle> <formcaptionstyle horizontalalign="center"></formcaptionstyle> <formtemplate> </formtemplate> <popupsettings modal="true" width="800px" closebuttontooltip="????"></popupsettings> </editformsettings> <pagerstyle pagesizecontroltype="radcombobox"></pagerstyle> </mastertableview> <pagerstyle pagesizecontroltype="radcombobox" /> </telerik:radgrid> </div> <asp:sqldatasource id="sqldatasource_grid" runat="server" connectionstring="<%$ connectionstrings:pigisconnectionstring %>"> <selectparameters> <asp:controlparameter controlid="ddlcompany" name="com_id" propertyname="selectedvalue" type="string" /> <asp:controlparameter controlid="ddlvahedsazmani" name="vahedsazmani_id" propertyname="selectedvalue" type="string" /> </selectparameters> </asp:sqldatasource> </telerik:radajaxpanel>
i load data radgrid below function. (i call function in page load)
void loaddata() { sqldatasource_grid.selectparameters.clear(); sqldatasource_grid.selectcommand = "spsct_select_from_sct_accesspermission"; sqldatasource_grid.databind(); radgrid1.datasource = sqldatasource_grid; radgrid1.rebind(); }
please add needdatasource event in radgrid.
<telerik:radgrid runat="server" id="radgrid1" onneeddatasource="radgrid1_needdatasource"> </telerik:radgrid>
your c# code:
protected void radgrid1_needdatasource(object sender, telerik.web.ui.gridneeddatasourceeventargs e) { sqldatasource_grid.selectparameters.clear(); sqldatasource_grid.selectcommand = "spsct_select_from_sct_accesspermission"; sqldatasource_grid.databind(); radgrid1.datasource = sqldatasource_grid; }
it automatically rebind/databind radgrid whenever needed. please check below link more information. commands invoke rebind() implicitly
Comments
Post a Comment