Hello
I am a newbie an try to following this video,
to get a first introduction in the Telerik RadControls: KevinBabcock_29.flv
The table name in the database LJT_BCEX (the same for Linq Object, no pluralization like LJT_BCEXs).
Does this cause problems?
I don't get an Error message in Visual Studio, but no data is shown. Here is my webservice:
| [System.Web.Script.Services.ScriptService] |
| public class BroadcastExchangeData : System.Web.Services.WebService |
| { |
| [WebMethod] |
| public Dictionary<string, object> GetBroadcastExchangeAndCount(int startIndex, int rowCount, |
| string sortExpressions, string filterExpressions) |
| { |
| var db = new LJITDataContext(); |
| var sort = !string.IsNullOrEmpty(sortExpressions); |
| var filter = !string.IsNullOrEmpty(filterExpressions); |
| var broadcastExchanges = (from b in db.LJT_BCEX |
| select b).Where(filter ? filterExpressions : "BXID > 0") |
| .OrderBy(sort ? sortExpressions : "BXID ASC"); |
| var count = filter ? broadcastExchanges.Count() : db.LJT_BCEX.Count(); |
| broadcastExchanges = broadcastExchanges.Skip(startIndex).Take(rowCount); |
| var retObj = new Dictionary<string, object> { { "BroadcastExchange", broadcastExchanges }, { "BroadcastExchangeCount", count } }; |
| return retObj; |
| } |
So the service itself seems to be ok. In debug I can see that it's returning the data properly (server side).
Here's the RadGrid Markup Code :
| <telerik:RadGrid ID="rgridMain" runat="server" AutoGenerateColumns="true" HorizontalAlign="Center" |
| AllowAutomaticDeletes="true" Width="98%" HeaderStyle-HorizontalAlign="Center"> |
| <HeaderStyle HorizontalAlign="Center"></HeaderStyle> |
| <ClientSettings EnableRowHoverStyle="true"> |
| <Scrolling AllowScroll="true" UseStaticHeaders="true" /> |
| <DataBinding CountPropertyName="BroadcastExchangeCount" DataPropertyName="BroadcastExchange" |
| FilterParameterName="filterExpressions" FilterParameterType="Linq" Location="~/Services/BroadcastExchangeData.asmx" |
| MaximumRowsParameterName="rowCount" SelectMethod="GetBroadcastExchangeAndCount" |
| SortParameterName="sortExpressions" SortParameterType="Linq" StartRowIndexParameterName="startIndex"> |
| </DataBinding> |
| <ClientEvents OnRowDblClick="OnRowDblClick" /> |
| </ClientSettings> |
| <MasterTableView EditMode="PopUp" DataKeyNames="BXID"> |
| <Columns> |
| <telerik:GridEditCommandColumn> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn HeaderText="Status" DataField="BXSTAT" /> |
| <telerik:GridBoundColumn HeaderText="Id" DataField="BXID" /> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
If I use Firefox/Firebug, then I can see, that there occurs a "Circular reference" with LJT_BCEX (that's the original class and table name and the name for the Linq Object).
Do I have to rename my Linq Object like Customer -> Customers?
I suggest all this because it seems relatively simple, and would make the Excel Export so much more "automatic" and hence the whole Telerk library so much more valuable.
At present the testing is tedious beyond belief - I just have to misspell one column name in the switch statement and unless I have carefully tested the resulting export column by column I will miss the error.
Andrew
Dear All,
I’m setting the visibility of the command item (Hyper Link)in the command item template (Add New Record) on the grid pre render event based on logged in user permissions.
The code used is shown below:
| foreach (GridItem Item in grdUsers.MasterTableView.GetItems(GridItemType.CommandItem)) |
| { |
| GridCommandItem CommandItem = (GridCommandItem)Item; |
| LinkButton InitLinkButton = (LinkButton)CommandItem.FindControl(functionalitiesRow.ControlName); |
| if (InitLinkButton != null) |
| { |
| InitLinkButton.Visible = false; |
| break; |
| } |
| } //End for each |
The problem is that when I do reordering for the column on the server side the code in grid pre render even is executed and the Hyper Link visibility is set to false but when the page appears the (Add New Record) hyper link is visible to the user and s/he can click on it.
This problem only appears on the reordering columns functionality.
I don’t want to reorder the column on client side, because am preserving the grid state and columns order for the logged in user.
Any suggests to my problem?
| function setDefaultReport() { |
| selectedReportsList.trackChanges(); |
| var selectedItem = selectedReportsList.get_selectedItem(); |
| if (selectedItem) { |
| if (defaultReport) { |
| defaultReport.set_imageUrl(""); |
| } |
| } |
| selectedItem.set_imageUrl("/images/icon.gif"); |
| defaultReport = selectedItem; |
| } |
| selectedReportsList.commitChanges(); |
| } |
| <telerik:GridTemplateColumn HeaderText="Class" UniqueName="Class" SortExpression="Class" ShowSortIcon="true" HeaderStyle-Width="200"> |
| <ItemTemplate> |
| <asp:Label ID="Label1" runat="server" Text='<%# Eval("Class") %>' /> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="ClassCombo" runat="server" Width="190px" Height="200px" MarkFirstMatch="true" |
| OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" OnClientDropDownClosed="OnClientDropDownClosed" |
| OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" |
| EnableLoadOnDemand="true" AllowCustomText="false" > |
| <ExpandAnimation Type="none" /> |
| <CollapseAnimation Type="none" /> |
| <WebServiceSettings Path="/Lookup.asmx" Method="Classes" /> |
| </telerik:RadComboBox> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| function OnClientItemsRequesting(sender, args){ |
| startTime = new Date(); |
| } |
| function OnClientItemsRequested(sender, args){ |
| var endTime = new Date(); |
| } |
| function OnClientSelectedIndexChanged(sender, args) { |
| var item = args.get_item(); |
| var text = item.get_text(); |
| var val = item.get_value(); |
| alert(val); |
| } |
| function OnClientDropDownClosed(sender, args) { |
| sender.clearItems(); |
| if(args.get_domEvent().stopPropagation) |
| args.get_domEvent().stopPropagation(); |
| } |
| Public Overrides Sub RenderControl(ByVal writer As System.Web.UI.HtmlTextWriter) |
| writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID) |
| writer.RenderBeginTag(HtmlTextWriterTag.Div) |
| MyBase.RenderControl(writer) |
| writer.RenderEndTag() |
| End Sub |