Telerik RadGrid not opening popup editor - telerik

I've a Telerik Radgrid displaying a list of customers. In the grid, I have a command button that's supposed to open a popup editor to add new customers. For some reason, the popup does not open. It shows a small flicker and nothing happens. Strangely enough, if I go into the database, manually add a customer record and refresh the grid, I'm able to open the editor.
Here is the grid definition in my ascx:
<telerik:RadGrid ID="CustomerList" runat="server"
GroupingEnabled="False" ShowStatusBar="True" OnPreRender="CustomerList_PreRender"
DataSourceID="CustomerDataSource"
OnItemCommand="CustomerList_ItemCommand" OnItemDataBound="CustomerList_ItemDataBound"
OnInsertCommand="CustomerList_InsertCommand" OnItemInserted="CustomerList_ItemInserted"
OnItemEvent="CustomerList_ItemEvent" >
<MasterTableView DataKeyNames="CustomerId" DataSourceID="CustomerDataSource"
AllowPaging="true" AutoGenerateColumns="False"
GridLines="None" EditMode="PopUp" ShowFooter="True"
InsertItemDisplay="Bottom" CommandItemDisplay="TopAndBottom" >
<CommandItemSettings AddNewRecordText="Add Customer" />
<Columns>
<telerik:GridBoundColumn DataField="CustomerId" DataType="System.Int32" FilterControlAltText="Filter CustomerId column" HeaderText="CustomerId" ReadOnly="True" SortExpression="CustomerId" UniqueName="CustomerId">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerName" FilterControlAltText="Filter CustomerName column" HeaderText="CustomerName" SortExpression="CustomerName" UniqueName="CustomerName">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
<ItemStyle Width="20px" Font-Underline="true" />
</telerik:GridEditCommandColumn>
</Columns>
<NoRecordsTemplate>
No customers have been created yet.
</NoRecordsTemplate>
<EditFormSettings EditFormType="WebUserControl" CaptionDataField="CustomerName"
UserControlName="~/UserControls/CustomerEditor.ascx"
>
<EditColumn UniqueName="EditCommandColumn" HeaderButtonType="TextButton">
</EditColumn>
<PopUpSettings ScrollBars="None" Width="581"/>
</EditFormSettings>
<PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" />
</MasterTableView>
</telerik:RadGrid>
Any help is most welcome!

Related

Telerik RadGrid Does not Show

I have a RadGrid That is used in several ASPX applications. It works fine in other apps. However when I copy and paste it into this aspx page it does not work. I get no error messages and the OnNeedData method shows records being pulled. All I get is a white line where the RadGrid should appear. Below is the RAdGrid Setup
<telerik:RadGrid ID="RadGridSubject" runat="server"
OnInsertCommand="RadGridSubject_InsertCommand"
OnUpdateCommand="RadGridSubject_UpdateCommand"
AllowAutomaticInserts="false"
AutoGenerateColumns="false"
OnNeedDataSource="RadGridSubject_NeedDataSource"
AllowAutomaticDeletes="false"
MasterTableView-AllowAutomaticInserts="true">
<MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top"
DataKeyNames="CaseId_FK, SubjectId" Font-Size="Medium"
NoMasterRecordsText="No Subjects Entered"
CommandItemSettings-AddNewRecordText="Add New Subject">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" />
<telerik:GridDateTimeColumn DataField="ReceivedDate" HeaderText="ReceivedDate" SortExpression="OrderDate"
PickerType="DatePicker" EnableTimeIndependentFiltering="true" DataFormatString="{0:MM/dd/yyyy}">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn UniqueName="SubjectName" HeaderText="Subject Name" DataField="SubjectName"></telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="SubjectDOB" HeaderText="DOB" SortExpression="DOB"
PickerType="DatePicker" EnableTimeIndependentFiltering="true" DataFormatString="{0:MM/dd/yyyy}">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn UniqueName="Race" HeaderText="Race" DataField="SubjectRace"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Sex" HeaderText="Sex" DataField="SubjectSex"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="JackectNumnber" HeaderText="Jackect #" DataField="Jacketnum"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="SID" HeaderText="SID #" DataField="SID"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="FBI" HeaderText="FBI #" DataField="FBI"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="SubjectOther" HeaderText="Other" DataField="SabjectOtherInfo"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn AllowFiltering="false">
<ItemTemplate>
<asp:Button ID="btnSubjectDelete" CssClass="btn btn-xs btn-danger" Text="Delete" runat="server" OnClick="btnSubjectDelete_Click" OnClientClick="confirmAspButton(this); return false;"></asp:Button>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditFormSettings UserControlName="SubjectEdit.ascx" EditFormType="WebUserControl" PopUpSettings-Modal="false">
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
Why would it work on other pages within the web app but not this one? When you copy and paste a RADGrid do I need to reset all of the properties?
This was an error on my part. I failed to Bind the RadGrid once I did that the control worked as designed.

Rebind detailtable in radgrid

i have a radgrid with detailtables ,
detailTable has "GridEditCommandColumn" and another "GridTemplateColumn" that contains linkbutton to remove row ,
<MasterTableView DataKeyNames="FEATURE_ID">
<Columns>
<telerik:GridBoundColumn DataField="FEATURE_ID" UniqueName="FeatureID" ></telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView ShowHeader="true" CommandItemDisplay="Top"
SkinID="RadGridSkin" Width="100%" runat="server" Name="Fees"
EditMode="InPlace">
<Columns>
<telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="FEE_TEMPLATE_ID" UniqueName="FeeID"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="DeleteFee">
<ItemTemplate>
<asp:LinkButton ID="RemoveFee" runat="server" CommandName="RemoveFee" Text="RemoveFee" ImageUrl="../../../images/cancel.png" ToolTip="<%$Resources:Strings,remove %>" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
in code behind in itemCommand event :
dataSource of radgrid is updated and Datable.acceptchanges() is called ;
how to rebind only the detailTable where changes have occurred ??
You didn't supply the name of your RadGrid, but the first thing I would try is:
RadGrid1.MasterTableView.DetailTables(0).Rebind(),
or, although I'm not sure whether this works for you (it compiles in VS for me), you might be able to say:
RadGrid1.MasterTableView.DetailTables("Fees").Rebind().
Obviously, replace 'RadGrid1' with the name of your RadGrid.

Telerik RadGrid: My "delete record" checkbox column is read only. How can I fix this?

Here's my grid:
<telerik:RadGrid AutoGenerateColumns="False" ID="grdUsers" DataSourceID="LinqDataSource1" AllowSorting="True" runat="server" GridLines="None" Skin="Office2007">
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
<MasterTableView TableLayout="Fixed" DataSourceID="LinqDataSource1">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn HeaderText="FirstName" DataField="FirstName" ReadOnly="True" SortExpression="FirstName" HeaderStyle-Width="150"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="LastName" HeaderStyle-Width="150" DataField="LastName" ReadOnly="True" SortExpression="LastName"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Email" DataField="Email" ReadOnly="True" SortExpression="Email"></telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn HeaderText="Delete?" HeaderStyle-Width="60" ReadOnly="false"></telerik:GridCheckBoxColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
As you can see, I have a GridCheckBoxColumn at the end that I would like the users to be able to select a few records and then click another button to delete them. The problem is that the check boxes are all disabled even though I set the ReadOnly property to false.
Any ideas?
You are using the GridCheckBoxColumn incorrectly. It must be bound to a datafield just like a GridBoundColumn. In your case, you need to place a CheckBox in an ItemTemplate of a GridTemplateColumn. This will achieve your desired result.
Here is a link from Telerik going through the entire process: http://www.telerik.com/help/aspnet/grid/grddeletegriditemsdependingoncheckboxstate.html

how to Grid without horizontal scroll and give vertical scroll header style

I use radgrid with scrolling but when scrolling is on the header (see the link for more info) of grid above the scroll looks different than the content header and on IE8 horizantal scroll is shown
The html markup of radgrid is below:
<telerik:RadGrid HeaderStyle-Height="20px" HeaderStyle-Width="500" BackColor="#ebebeb" ID="PropertySelectGrid" AutoGenerateColumns="false"
runat="server" GridLines="None" Width="450px" OnItemCreated="PropertySelectGrid_ItemCreated" TableLayout="Fixed" >
<MasterTableView CommandItemDisplay="None" BackColor="#ebebeb" Width="425px" CurrentResetPageIndexAction="SetPageIndexToFirst"
Dir="LTR" Frame="Border" TableLayout="Fixed">
<Columns>
<telerik:GridBoundColumn ItemStyle-Width="0px" DataField="Id" Visible="false" DataType="system.string"
ReadOnly="True" SortExpression="Id" UniqueName="Id">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Justify" ItemStyle-Width="20px" HeaderStyle-Width="20px" UniqueName="Selection">
<ItemTemplate>
<asp:CheckBox Width="15px" ID="SelectCheckBox" runat="server" TextAlign="Left" AutoPostBack="false" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="Name" ItemStyle-Width="150px" HeaderStyle-Width="150px" DataType="system.string"
HeaderText="Adı" ReadOnly="True" SortExpression="Name" UniqueName="Name">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="PropertyValueColumn" ItemStyle-Width="200" HeaderStyle-Width="234" HeaderText="Değeri">
<ItemTemplate>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<NoRecordsTemplate>
Listelenecek Kayıt Bulunmamaktadır.</NoRecordsTemplate>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" FrozenColumnsCount="1">
</Scrolling>
</ClientSettings>
</telerik:RadGrid>
so how to disable horizontal scroll and headerstyle for vertical scroll like the content header?
Thanks

Binding navigation property to RadGrid while using EntityDataSource control

I'm new to Entity Framework and I got stuck in an issue while trying to bind a navigation property (foreign key reference) to a dropdownlist. I have Telerik RadGrid control which gets the data using a EntityDataSource control. Here is the model description:
Applications: AppId, AppName, ServerId
Servers: ServerId, ServerName
The Applicaitons.ServerId is a foreign key reference to Servers.ServerId. The RadGrid lists the applications and allows the user to insert/update/delete an application. I want to show the server names as a dropdownlist in edit mode which I'm not able to. . Here is my aspx code:
<telerik:RadGrid ID="gridApplications" runat="server" Skin="Sunset"
AllowAutomaticInserts="True" AllowAutomaticDeletes="True"
AllowPaging="True" AllowAutomaticUpdates="True"
AutoGenerateColumns="False" OnItemCreated="gridApplications_ItemCreated"
DataSourceID="applicationsEntityDataSource" Width="50%"
OnItemInserted="gridApplications_ItemInserted"
OnItemUpdated="gridApplications_ItemUpdated"
OnItemDeleted="gridApplications_ItemDeleted" GridLines="None">
<MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="False" DataKeyNames="AppId" DataSourceID="applicationsEntityDataSource">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderText="Edit" ItemStyle-Width="10%">
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" ConfirmText="Are you sure you want to delete this application?" ConfirmTitle="Confirm Delete" ConfirmDialogType="Classic" ItemStyle-Width="10%" HeaderText="Delete">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="AppId" UniqueName="AppId" Visible="false" HeaderText="Application Id" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AppName" UniqueName="AppName" HeaderText="Application Name" MaxLength="30" ItemStyle-Width="40%">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn DataField="ServerId" UniqueName="ServerId" HeaderText="Server Hosted" EditFormColumnIndex="1">
<EditItemTemplate>
<asp:DropDownList ID="ddlServerHosted" runat="server" DataTextField="Servers.ServerName" DataValueField="ServerId" Width="40%">
</asp:DropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditFormSettings ColumnNumber="2" CaptionDataField="AppId" InsertCaption="Insert New Application" EditFormType="AutoGenerated">
<EditColumn InsertText="Insert record" EditText="Edit application id #:" EditFormColumnIndex="0" UpdateText="Application updated" UniqueName="InsertCommandColumn1" CancelText="Cancel insert" ButtonType="ImageButton"></EditColumn>
<FormTableItemStyle Wrap="false" />
<FormTableStyle GridLines="Horizontal" CellPadding="2" CellSpacing="0" Height="110px" Width="110px" />
<FormTableAlternatingItemStyle Wrap="false" />
<FormStyle Width="100%" BackColor="#EEF2EA" />
<FormTableButtonRowStyle HorizontalAlign="Right" />
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
<asp:EntityDataSource ID="applicationsEntityDataSource" runat="server"
ConnectionString="name=AnalyticsEntities" EnableDelete="True"
EntityTypeFilter="Applications" EnableInsert="True" EnableUpdate="True" EntitySetName="Applications"
DefaultContainerName="AnalyticsEntities" Include="Servers">
</asp:EntityDataSource>
I tried another approach where I replaced the GridTemplateColumn with the following code
<telerik:RadComboBox ID="RadComboBox1" DataSourceID="serversEntityDataSource" DataTextField="ServerName" DataValueField="ServerId" AppendDataBoundItems="true" runat="server" >
<Items>
<telerik:RadComboBoxItem />
</Items>
and using a separate EntityDataSource control as follows:
<asp:EntityDataSource ID="serversEntityDataSource" runat="server"
ConnectionString="name=AnalyticsEntities" EnableDelete="True"
EntityTypeFilter="Servers" EnableInsert="True" EnableUpdate="True" EntitySetName="Servers"
DefaultContainerName="AnalyticsEntities">
</asp:EntityDataSource>
but, I get the following error.
Application cannot be inserted. Reason: Entities in 'AnalyticsEntities.Applications' participate in the 'FK_Servers_Applications' relationship. 0 related 'Servers' were found. 1 'Servers' is expected.
My question is, how do you bind the navigation property and load the values in the DropDownList/RadComboBox control?
I believe you bind your dropdownlist to that second datasource instead of the grid's datasource (as you did in the second example). Then you set the SelectedValue property on the dropdown/combobox using the <%# BIND("ServerId") %> syntax within the template.

Resources