
I am utilizing client databinding and I cannot get the grid to populate with
anything. I am returning all my data is JSON format and its verified by
Web Developer Helper. The grid keeps displaying "No records to display.".
Code is posted below. Any ideas.
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title></title> |
| </head> |
| <script type="text/javascript"> |
| function RebindGrid() { |
| var mtv = $find("<%= RadGrid2.ClientID %>").get_masterTableView(); |
| mtv.rebind(); |
| return false; |
| } |
| function GridCommand(sender, args) { |
| } |
| </script> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager id="PlaybookScriptManager" runat="server" /> |
| <asp:Button ID="dsd" runat="server" OnClientClick="return RebindGrid();" text="Rebind" /> |
| <br /> |
| <rad:RadGrid runat="server" ID="RadGrid2" AutoGenerateColumns="false" Height="670px" AllowFilteringByColumn="true"> |
| <MasterTableView DataKeyNames="EventID" ClientDataKeyNames="EventID" Height="670px" > |
| <Columns> |
| <rad:GridBoundColumn HeaderText="EventID" DataField="EventID" /> |
| <rad:GridBoundColumn HeaderText="EventName" DataField="EventName" /> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings> |
| <ClientEvents OnCommand="GridCommand" /> |
| <Scrolling AllowScroll="true" /> |
| <DataBinding Location="Default.aspx" SelectMethod="GetEvents" DataPropertyName="Events" |
| FilterParameterName="filterexp" FilterParameterType="Linq" /> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| </rad:RadGrid> |
| </form> |
| </body> |
| </html> |
| [WebMethod] |
| public static Dictionary<string, object> GetEvents(string filterexp) |
| { |
| var filter = !string.IsNullOrEmpty(filterexp); |
| var data = new DataClasses1DataContext(); |
| var events = (from e in data.Events |
| select new |
| { |
| EventID = e.EventID, |
| EventName = e.EventName |
| }) |
| .Where(filter ? filterexp : "EventID > 0"); |
| return new Dictionary<string,object> {{"Events", events}}; |
| } |
//code behind
| RadPanelItem panelItem = (RadPanelItem)RadPanelBar2.FindItemByValue("templateHolder"); | |||||||||||||||
| panelItem.Expanded = true; | |||||||||||||||
| panelItem.ChildGroupHeight = Unit.Pixel(150); | |||||||||||||||
| RadMenu myMenu = new RadMenu(); | |||||||||||||||
| myMenu.Width = Unit.Percentage(100); | |||||||||||||||
| //myMenu.Height = Unit.Pixel(500); | |||||||||||||||
| myMenu.DefaultGroupSettings.Height = Unit.Percentage(100); | |||||||||||||||
| myMenu.EnableRootItemScroll = true; | |||||||||||||||
| //myMenu.EnableAutoScroll = true; | |||||||||||||||
| myMenu.AutoScrollMinimumHeight = 150; | |||||||||||||||
| myMenu.Flow = ItemFlow.Vertical; | |||||||||||||||
| myMenu.DataTextField = "Text"; | |||||||||||||||
| myMenu.DataFieldID = "ID"; | |||||||||||||||
| myMenu.DataFieldParentID = "ParentId"; | |||||||||||||||
| myMenu.DataSource = siteData; | |||||||||||||||
| myMenu.DataBind(); | |||||||||||||||
panelItem.Controls.Add(myMenu);
|
protected
void btnExportWord_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
RadGrid radGrid = this.getData();
this.ConfigureExportation(radGrid);
radGrid.MasterTableView.ExportToWord();
}
How you can see, I create a new radgrid where it is filled out by getData method. I created a new radgrid because on page, the radgrid has jus some columns and I'd like to export all columns from table to word or excel file.
See the getData() Method:
private
RadGrid getData()
{
RadGrid radGrid = new RadGrid();
radGrid.DataSource = gobjBLProduct.List(
this.Company, this.txtSearch.Text.Trim());
radGrid.DataBind();
return radGrid;
}
Now, See ConfigureExportatio() Method:
private
void ConfigureExportation(RadGrid pradGrid)
{
pradGrid.ExportSettings.ExportOnlyData =
true;
pradGrid.ExportSettings.IgnorePaging =
true;
pradGrid.ExportSettings.OpenInNewWindow =
true;
pradGrid.ExportSettings.FileName =
"List of Product - " + DateTime.Now.ToShortDateString();
}
The problem is when I click on word button there is an exception where it is showed this message: "RadGrid must be DataBound" before exporting."
I didnt undertand why this error. What mistake did i do?
Can anybody help me, please?
Thank you for attention,
Carlos
Hi,
I have a problem with a custom fields in my RadEditor.Modules.<lang>.resx file. I've decided to extend NodeInspector with several fields for custom attributes (e.g. attr1, attr2, etc.), using ~\Scripts\Editor\Modules.js
In RadEditor.Modules.<lang>.resx file I've added additional fields for each attribute with description, also to the RadEditor.Modules.resx file add the same attributes.
But when I launch app near custom attributes always stands description «undefined». When I change default fields changes is apllying, but custom fields are ignored.
Can you help me?
Thanks in advance
P.s. sorry for my english
| <asp:UpdatePanel runat="server" ID="upSlider"> |
| <ContentTemplate> |
| <telerik:RadSlider runat="server" ID="sldrTest" AutoPostBack="true" ItemType="Item"> |
| <Items> |
| <telerik:RadSliderItem Text="Value 1" Value="1" /> |
| <telerik:RadSliderItem Text="Value 2" Value="2" /> |
| <telerik:RadSliderItem Text="Value 3" Value="3" /> |
| <telerik:RadSliderItem Text="Value 4" Value="4" /> |
| <telerik:RadSliderItem Text="Value 5" Value="5" /> |
| </Items> |
| </telerik:RadSlider> |
| </ContentTemplate> |
| </asp:UpdatePanel> |