This is a migrated thread and some comments may be shown as answers.

RADGrid Commands Does not work

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siva Karthik
Top achievements
Rank 1
Siva Karthik asked on 26 Aug 2015, 08:06 PM

Hi,

We have a website integrated with Sitefinity(CMS) and we started using Telerik  controls. I have encountered a problem which needs to be solved as soon as possible to meet our deadline. 

The RadGrid was working till this afternoon, we realized the commands does not fire anymore. The grid displays the rows but the "Add New Record", "Edit" and "Delete" does not work. These were working before, not sure what happened now. All I could find is, there are few JavaScript errors (please see the attached image). 

 The grid is also pasted below for your review. Please help us out of this issue.

 <telerik:RadGrid ID="radProviderListGrid" AllowAutomaticDeletes="true"
            DataSourceID="sqlCEProviderActivities" AllowSorting="True" AllowPaging="True" Width="650px"
            runat="server" PageSize="50"
            AllowAutomaticInserts="false"
            Skin="WebBlue" OnItemCommand ="radProviderListGrid_ItemCommand"  OnItemDeleted="radProviderListGrid_ItemDeleted" OnItemUpdated="radProviderListGrid_ItemUpdated" 
            OnItemInserted ="radProviderListGrid_ItemInserted" OnInsertCommand="radProviderListGrid_InsertCommand" OnUpdateCommand="radProviderListGrid_UpdateCommand" 
            MasterTableView-DataKeyNames="ID" AutoGenerateColumns="false" ShowGroupPanel="True" EnableHierarchyExpandAll="true" EnableLinqExpressions="false" GridLines="None">
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            <MasterTableView Width="100%" CommandItemDisplay="Top" EditMode="EditForms" DataSourceID="sqlCEProviderActivities" DataKeyNames="ID" AutoGenerateColumns="false" ShowGroupFooter="true">
                <NoRecordsTemplate>
                    <div>
                        There are no CE Provider Activities to display
                    </div>
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="EditCommandColumn"/>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID" Visible="true">
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="StartDate" HeaderText="Start Date" SortExpression="StartDate" UniqueName="StartDate" DataFormatString="{0:d}">
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="EndDate" HeaderText="End Date" SortExpression="EndDate" UniqueName="EndDate" DataFormatString="{0:d}"/>
                    <telerik:GridBoundColumn DataField="City" HeaderText="City" SortExpression="City" UniqueName="City">
                    </telerik:GridBoundColumn> 
                    <telerik:GridCheckBoxColumn DataField="IsOngoingActivity" HeaderText="Ongoing Activity?" DataType="System.Boolean" SortExpression="IsOngoingActivity" UniqueName="IsOngoingActivity"/>
                    <telerik:GridCheckBoxColumn DataField="ListOnSite" HeaderText="List On Site" DataType="System.Boolean" SortExpression="ListOnSite" UniqueName="ListOnSite"/>
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="LinkButton" UniqueName="DeleteCommandColumn" ConfirmText="Delete Row?" ConfirmTitle="Delete?" />
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <EditColumn ButtonType="ImageButton" />
                    <FormTemplate>
                        <p></p>
                        <p><b>CE Provider Activity Details</b></p>
                        <hr />
                         <table class="formTable">
                                       
                                        <tr>
                                            <td style="text-align:right">Do not list on site</td>
                                            <td class="control">
                                                <asp:CheckBox ID="chkDoNotListOnsite" runat="server" Checked='<%# IIf(DataBinder.Eval(Container.DataItem, "ListOnSite") Is DBNull.Value, False, Eval("ListOnSite"))%>' />
                                            </td>
                                            <td style="text-align:right">Is Ongoing Activity?</td>
                                            <td class="control">
                                                <asp:CheckBox ID="chkOngoingActivity" runat="server" Checked='<%# IIf(DataBinder.Eval(Container.DataItem, "IsOngoingActivity") Is DBNull.Value, False, Eval("IsOngoingActivity"))%>'/>
                                            </td>                                        
                                        </tr>
                                        <tr>
                                          <td style="text-align:right">Start Date :</td>
                                            <td class="control">
                                                <telerik:RadDatePicker ID="radDateStartDate" Width="150px" runat="server" DbSelectedDate='<%# Bind("StartDate")%>' Skin="Metro">
                                                </telerik:RadDatePicker>
                                            </td>  
                                            
                                            <td style="text-align:right">End Date :</td>
                                            <td class="control">
                                                <telerik:RadDatePicker ID="radDateEndDate" Width="150px" runat="server"  DbSelectedDate='<%# Bind("EndDate")%>' Skin="Metro">
                                                </telerik:RadDatePicker>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td style="text-align:right">Country</td>
                                            <td class="control">
                                                <asp:DropDownList runat="server" ID="ddlCountry" class="dropdownlist" DataSourceID="sqlCountries" 
                                                     DataTextField="Country" >
                                                </asp:DropDownList>
                                            </td>
                                             <td style="text-align:right">Languages</td>
                                            <td class="control"><asp:DropDownList runat="server" ID="ddlLanguages" class="dropdownlist" DataTextField='<%# Bind("Languages")%>'>
                                                <asp:ListItem></asp:ListItem>
                                                    <asp:ListItem>English</asp:ListItem>
                                                    <asp:ListItem>French</asp:ListItem>    
                                                    <asp:ListItem>English & French</asp:ListItem>    
                                            </asp:DropDownList></td>

                                        </tr>
                                        
                                        <tr>
                                            <td style="text-align:right">State/Province</td>
                                            <td class="control">
                                                <asp:DropDownList runat="server" ID="ddlStates" class="dropdownlist" DataSourceID="sqlStates" DataTextField="FullName" />
                                            </td>
                                            <td style="text-align:right">Registration Fee</td>
                                            <td class="control">
                                                <telerik:RadNumericTextBox ID="radNumericTextBox" runat="server" class="textBox" NumberFormat-DecimalDigits="2" Type="Currency" MinValue="0" Text='<%# Bind("RegistrationFee")%>'> 
                                                </telerik:RadNumericTextBox></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right"> City </td>
                                             <td class="control">
                                                 <asp:TextBox ID="txtCity" runat="server" class="textBox" Text='<%# Bind("City")%>'>
                                                </asp:TextBox>
                                             </td>
                                            <td>

                                            </td>
                                            <td>

                                            </td>
                                        </tr>
                                        
                                         <tr>
                                            <td style="text-align:right">Website</td>
                                            <td colspan="3"><asp:TextBox ID="txtWebsite" runat="server" ClientIdMode="Static" class="URL" Text='<%# Bind("Website")%>'>
                                                </asp:TextBox>
                                                <asp:RegularExpressionValidator ID="regUrl"
                                                    runat="server"
                                                    ControlToValidate="txtWebsite"
                                                    ValidationExpression="^((http|https)://)?([\w-]+\.)+[\w]+(/[\w- ./?]*)?$"
                                                    Text="Enter a valid URL" ForeColor="red"/>
                                            </td>
                                        </tr>
                                    </table>
                        <hr />
                        <table id="tblEditForm" style="border-collapse: collapse;">
                            <tr><td colspan="2"></td></tr>
                            <tr>
                                <td>
                                    <table><tr><td colspan="2">&nbsp;</td></tr></table>
                                </td>
                                <td>
                                    <table id="tblEditFormInner">
                                        <tr>
                                            <td colspan="2">
                                                <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                    runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'></asp:Button>&nbsp;
                                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                    CommandName="Cancel"></asp:Button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings AllowColumnsReorder="True">
                <Selecting AllowRowSelect="True"></Selecting>
            </ClientSettings>
            <GroupingSettings ShowUnGroupButton="true" />
        </telerik:RadGrid>

 

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 31 Aug 2015, 01:13 PM
Hi,

I examined the code, however, I did not see anything that is amiss. Nevertheless, would you try couple of things that could narrow the search of the issue.

  • If you have enabled AJAX - disable it. You can do this by setting the EnableAJAX property of RadAjaxManager to false. Check if there are any server-side errors thrown after this
  • Also, try to remove the EditForm template and see if the error is still present with the default EditForm
  • Make sure that you are using the latest version of the controls. The current release is 2015.2.826

In case the issue is still observed please share the complete markup of the page with the related code-behind.


Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Siva Karthik
Top achievements
Rank 1
answered on 01 Sep 2015, 01:13 PM

Hi Viktor,

Thanks a lot for reply.

I started building the Grid from scratch. It works fine now. But I did not figure out exact problem. 

I assume something was wrong with my SQL data source. I was using a select procedure with ControlParameter. I changed it to SessionParameter. But i didnot understand how it worked before and why not after few days. 

 

I have couple of other issues if you could help. 

1. RadAsyncUpload displays "Resource not found" on the labels (Please see the attached screenshot)

2. How to handle client side events(using JQuery) inside RadGrid Edit template. For example, checkbox click should enable/disable few textboxes in same edit form, Startdate and end date validations..etc

3. How to develop cascading drop downs inside RadGrid Edit form.

Please help in getting these resolved.

 

Regards,

Siva

 

0
Viktor Tachev
Telerik team
answered on 03 Sep 2015, 04:13 PM
Hello Siva,

I will go through your queries one by one.

The first issue is most likely caused because the resource used to localize the "remove" label cannot be located. If you would like to localize the RadAsyncUpload control please make sure you follow the approach described int the article linked below:


Regarding your second query. The code snippet below outline how you can get reference to a TextBox and RadTextBox in an edit template.

Markup:

<EditFormSettings EditFormType="Template">
    <FormTemplate>
         
        <asp:CheckBox runat="server" ID="CheckBox1" onclick="onClick(this, event);" />
 
        <asp:TextBox ID="TextBox1" runat="server" />
        <telerik:RadTextBox ID="RadTextBox2" runat="server" />
 
    </FormTemplate>
</EditFormSettings>


JavaScript:

function onClick(sender, args) {
    var grid = $find("<%= RadGrid1.ClientID %>");
    var editItem = $telerik.$(sender).closest("tr")[0];
 
    var textBoxElement = $telerik.findElement(editItem, "TextBox1");
    var radTextBoxControl = $telerik.findControl(editItem, "RadTextBox2");
 
 
}

In order to implement cascading dropdown controls you should use an approach that is similar to the one illustrated in the following example




Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Siva Karthik
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Siva Karthik
Top achievements
Rank 1
Share this question
or