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

Invalid postback or callback argument error

2 Answers 341 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chom
Top achievements
Rank 1
Chom asked on 12 Mar 2010, 05:41 AM
Hello

Could someone help me with this problem. I have 3 grids on a page. I am adding categories to grid 3 (category grid) base on what row is selected in grid 1 (lisitings grid). If I have 3 listings in grid 1 (listings grid) and have added a category to grid 3 with listing 3 selected. When I go and click on listing 2 in the listings grid to add a category for listing 2 I get this error.

Error:-

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

I have tried changing things in the ajax manager and different methods to get the data from the db, but am still having the same problem. In fact after I have added 1 category to grid 3 when I click anywhere on the page I get the above error.

 

 <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">  
    <link href="styles/buslistingsales1.css" rel="stylesheet" type="text/css" /> 
    </asp:Content> 
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadTabStripListings">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadTabStripListings" /> 
                    <telerik:AjaxUpdatedControl ControlID="ListingsMultiPage" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="ListingsMultiPage">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadTabStripListings" /> 
                    <telerik:AjaxUpdatedControl ControlID="ListingsMultiPage" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="lblDuplicateCategory" /> 
                    <telerik:AjaxUpdatedControl ControlID="rgCategory" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="rgSlides">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="rapBusinessListings" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="ddlCategory">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="ddlSubCategory1" /> 
                    <telerik:AjaxUpdatedControl ControlID="ddlSubCategory2" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="ddlSubCategory1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="ddlSubCategory2" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="rgCategory">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="ListingsMultiPage" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings>          
<%--        <ClientEvents OnRequestStart="mngRequestStarted" />--%> 
        </telerik:RadAjaxManager> 
<%--       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>--%> 
 
        <asp:SqlDataSource ID="dsBusinessListingDescription" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"   
        SelectCommand="admin_Settings_GetBusinessListingDescription" SelectCommandType="StoredProcedure">  
        <SelectParameters> 
        <asp:Parameter Name="BusinessListingIndex" Type="Int16" /> 
        </SelectParameters> 
        </asp:SqlDataSource>             
    <div class="heading">Business Listings: Plan and Pricing Options</div> 
    <div class="saContent">  
    <div class="saFiltering">  
    <div class="controlsdiv">  
    <table class="TableAddress" style="margin-bottom:10px;">  
    <tr> 
    <td class="TextRight">Username:</td><td class="TextLeft"><asp:Label ID="lblUserName" runat="server" ForeColor="Blue"></asp:Label></td>  
    <td class="TextRight">Customer ID:</td><td class="TextLeft"><asp:Label ID="lblCustomerID" runat="server" ForeColor="Blue"></asp:Label></td>  
    </tr> 
    </table> 
    </div> 
 
    <div class="controlsdiv">  
    <table class="TableAddress" style="margin-bottom:5px;">  
    <tr><td class="TextLeft"><b>1. Business Listings:</b><br />Select the type of listing to add business to below.</td></tr>  
    </table> 
 
        <telerik:RadTabStrip ID="RadTabStripListings" runat="server"   
            MultiPageID="ListingsMultiPage" SelectedIndex="0" > 
      <Tabs> 
      <telerik:RadTab runat="server" Text="Listings with Slides for each business" /> 
      <telerik:RadTab runat="server" Text="Listings with No Slides for any business" /> 
      <telerik:RadTab runat="server"   
              Text="Listings with 1 set of common Slides for all businesses"   
              Selected="True" /> 
      </Tabs> 
        </telerik:RadTabStrip>              
        <telerik:RadMultiPage ID="ListingsMultiPage" runat="server" Width="100%"   
            SelectedIndex="0">  
            <telerik:RadPageView ID="ListingsPageViewWithImages" runat="server">  
                <div class="tabDivTop">  
                <asp:SqlDataSource ID="dsBusinessListings" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"   
        SelectCommand="admin_Customers_BusinessListing_SelectPrimaryInfo" SelectCommandType="StoredProcedure"   
        InsertCommand="admin_Customers_BusinessListing_InsertPrimaryInfo" InsertCommandType="StoredProcedure"   
        DeleteCommand="admin_Customers_BusinessListing_DeleteRowPrimaryInfo" DeleteCommandType="StoredProcedure">  
        <SelectParameters> 
        <asp:Parameter Name="CustomerID" Type="String" /> 
        <asp:Parameter Name="OrderID" Type="String" /> 
        <asp:Parameter Name="WithSlideNoSlide" Type="String" /> 
        </SelectParameters> 
        <InsertParameters> 
        <asp:Parameter Name="CustomerID" Type="String" /> 
        <asp:Parameter Name="OrderID" Type="String" /> 
        <asp:Parameter Name="TabStripSelectedIndex" Type="Int16" /> 
        <asp:Parameter Name="BusinessListingDescription" Type="String" /> 
        <asp:Parameter Name="WithSlideNoSlide" Type="String" />          
        </InsertParameters> 
        <DeleteParameters> 
        <asp:Parameter Name="CustomerID" Type="String" /> 
        <asp:Parameter Name="OrderID" Type="String" /> 
        <asp:Parameter Name="BusinessListingNumber" Type="Int16" /> 
        <asp:Parameter Name="WithSlideNoSlide" Type="String" />   
        <asp:Parameter Name="TabStripSelectedIndex" Type="Int16" />         
        </DeleteParameters> 
        </asp:SqlDataSource> 
          
                   <telerik:RadAjaxPanel ID="rapBusinessListings" runat="server" Width="100%">  
                    <telerik:RadGrid ID="rgListingWithImages" runat="server" GridLines="None" Skin="Office2007" 
                        PageSize="8" ClientSettings-Scrolling-SaveScrollPosition="true" AllowPaging="True">  
                        <HeaderStyle HorizontalAlign="Left" /> 
                        <ItemStyle HorizontalAlign="Left" /> 
                        <AlternatingItemStyle HorizontalAlign="Left" /> 
                        <ClientSettings EnablePostBackOnRowClick="true">  
                            <Selecting AllowRowSelect="true" /> 
                        </ClientSettings> 
                        <PagerStyle Mode="NumericPages" /> 
                        <MasterTableView PageSize="5" AutoGenerateColumns="False" DataKeyNames="ID" CommandItemDisplay="Top" 
                            ShowHeadersWhenNoRecords="true" NoMasterRecordsText="Insert New Business Listing.">  
                            <Columns> 
                                <telerik:GridButtonColumn CommandName="DeleteRow" CommandArgument="DeleteRow" HeaderText="" 
                                    Text="Delete" UniqueName="DeleteRow">  
                                </telerik:GridButtonColumn> 
                                <telerik:GridBoundColumn DataField="ID" DefaultInsertValue="" HeaderText="ID" SortExpression="ID" 
                                    UniqueName="ID" DataType="System.Int32" ReadOnly="True" Visible="false">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="CustomerID" DefaultInsertValue="" HeaderText="CustomerID" 
                                    SortExpression="CustomerID" UniqueName="CustomerID" Visible="false">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="OrderID" DefaultInsertValue="" HeaderText="OrderID" 
                                    SortExpression="OrderID" UniqueName="OrderID">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="OrderDate" DataType="System.DateTime" DefaultInsertValue="" 
                                    HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate" Visible="false">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="BusinessListingNumber" DataType="System.Int32" 
                                    DefaultInsertValue="" HeaderText="Business Number" SortExpression="BusinessListingNumber" 
                                    UniqueName="BusinessListingNumber">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="NumberOfImages" DataType="System.Int32" DefaultInsertValue="" 
                                    HeaderText="Slides" SortExpression="Number Of Images" UniqueName="NumberOfImages">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="NumberOfCategories" DataType="System.Int32" DefaultInsertValue="" 
                                    HeaderText="Categories" SortExpression="Number Of Categories" UniqueName="NumberOfCategories">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="BusinessListingDescription" DefaultInsertValue="" 
                                    HeaderText="Description" SortExpression="BusinessListingDescription" 
                                    UniqueName="BusinessListingDescription">  
                                </telerik:GridBoundColumn> 
                            </Columns> 
                            <PagerStyle Mode="NextPrev" /> 
                            <CommandItemTemplate> 
                                <table style="float: left; width: 100%;">  
                                    <tr> 
                                        <td style="text-align: left">  
                                            <asp:Button ID="btnInsertNewRecord" runat="server" CommandName="InsertNewRecord" 
                                                Text="New Listing" Width="90px" Height="25px" /> 
                                        </td> 
                                        <td>                                              
                                        </td> 
                                    </tr> 
                                </table> 
                            </CommandItemTemplate> 
                        </MasterTableView> 
                    </telerik:RadGrid> 
              </telerik:RadAjaxPanel> 
                                        
                </div> 
            </telerik:RadPageView> 
            <telerik:RadPageView ID="ListingsPageViewwithoutImages" runat="server">  
                <div class="tabDivTop">  
                </div> 
            </telerik:RadPageView> 
            <telerik:RadPageView ID="ListingsPageViewSlides" runat="server">  
                <div class="tabDivTop">  
                </div> 
            </telerik:RadPageView> 
        </telerik:RadMultiPage>   
             </div>         
 
        <div style="float:left; width:100%">  
        <table class="TableAddress" style="margin-bottom:10px; width:100%">  
        <tr> 
        <td class="TextLeft"><b>2. Slides</b></td>  
        </tr> 
        <tr> 
        <td class="TextLeft">Slides for Business Listings.</td> 
        </tr> 
        </table>          
        </div> 
        <div class="controlsdiv">  
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
 
                <script type="text/javascript">  
                    // <![CDATA[
                    // on insert and update buttons, temporarily disable AJAX // to allow upload actions
//                    function mngRequestStarted(ajaxManager, eventArgs) {
//                        var re = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
//                        if (eventArgs.EventTarget.match(re)) {
//                            eventArgs.EnableAjax = false;
//                        }
//                    }
                    function conditionalPostback(sender, eventArgs) {
                        var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
                        if (eventArgs.get_eventTarget().match(theRegexp)) {
                            var upload = $find(window['UploadId']);
                            //AJAX is disabled only if file is selected for upload
                            if (upload.getFileInputs()[0].value != "") {
                                eventArgs.set_enableAjax(false);
                            }
                        }
                    }
                    function validateRadUpload(source, e) {
                        e.IsValid = false;
                        var upload = $find(source.parentNode.getElementsByTagName('div')[0].id);
                        var inputs = upload.getFileInputs();
                        for (var i = 0; i < inputs.length; i++) {
                            //check for empty string or invalid extension
                            if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value)) {
                                e.IsValid = true;
                                break;
                            }
                        }
                    }
                    // ]]> 
                </script> 
 
            </telerik:RadCodeBlock> 
        <asp:SqlDataSource ID="dsSlides" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"   
        SelectCommand="admin_Customers_BusinessListings_Slides_SelectSlideInfo_1" SelectCommandType="StoredProcedure"   
        InsertCommand="admin_Customers_BusinessListings_Slides_InsertPrimaryInfo" InsertCommandType="StoredProcedure"   
        DeleteCommand="admin_Customers_BusinessListings_Slides_DeleteSlideRow_1" DeleteCommandType="StoredProcedure"   
        UpdateCommand="admin_Customers_BusinessListings_Slides_UpdateSlideInfo_1" UpdateCommandType="StoredProcedure">  
        <SelectParameters> 
        <asp:Parameter Name="CustomerID" /> 
        <asp:Parameter Name="OrderID" /> 
        <asp:Parameter Name="BusinessListingNumber" /> 
        </SelectParameters> 
        <InsertParameters> 
        <asp:Parameter Name="CustomerID" Type="String" /> 
        <asp:Parameter Name="OrderID" Type="String" /> 
        <asp:Parameter Name="BusinessListingNumber" Type="Int16" /> 
        </InsertParameters> 
        <DeleteParameters> 
        <asp:Parameter Name="CustomerID" Type="String" /> 
        <asp:Parameter Name="OrderID" Type="String" /> 
        <asp:Parameter Name="SlideID" Type="String" /> 
        <asp:Parameter Name="BusinessListingNumber" Type="Int16" /> 
        </DeleteParameters> 
        <UpdateParameters> 
        <asp:Parameter Name="SlideID" Type="String" /> 
        <asp:Parameter Name="Title" Type="String" /> 
        <asp:Parameter Name="Description" Type="String" /> 
        <asp:Parameter Name="ImageData" DbType="Binary" /> 
        </UpdateParameters> 
        </asp:SqlDataSource> 
          
        <div style="text-align:left">  
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="conditionalPostback" 
                Width="100%">  
                <telerik:RadGrid ID="rgSlides" runat="server" GridLines="None" Skin="Hay" PageSize="8" 
            ClientSettings-Scrolling-SaveScrollPosition="true" AllowPaging="True" AllowAutomaticUpdates="True" 
            OnItemCreated="rgSlides_ItemCreated" OnItemDataBound="rgSlides_ItemDataBound">  
            <HeaderStyle HorizontalAlign="Left" /> 
            <ItemStyle HorizontalAlign="Left" /> 
            <AlternatingItemStyle HorizontalAlign="Left" /> 
            <ClientSettings EnablePostBackOnRowClick="true">  
                <Selecting AllowRowSelect="true" /> 
            </ClientSettings> 
            <PagerStyle Mode="NumericPages" /> 
            <MasterTableView PageSize="1" AutoGenerateColumns="False" DataKeyNames="SlideID" 
                CommandItemDisplay="Top" ShowHeadersWhenNoRecords="true" NoMasterRecordsText="Click New Slide to insert a new slide row." 
                EditMode="PopUp">  
                <Columns> 
                    <telerik:GridButtonColumn CommandName="DeleteRow" CommandArgument="DeleteRow" HeaderText="" 
                        Text="Delete" UniqueName="DeleteRow">  
                    </telerik:GridButtonColumn> 
                    <telerik:GridTemplateColumn UniqueName="ID" SortExpression="ID" ReadOnly="true" Visible="false">  
                        <ItemTemplate> 
                            <asp:Label ID="lblID" runat="server" Text='<% #Bind("ID") %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn HeaderText="CustomerID" UniqueName="CustomerID" SortExpression="CustomerID" 
                        Visible="false">  
                        <ItemTemplate> 
                            <asp:Label ID="lblCustomerID" runat="server" Text='<%#Bind("CustomerID") %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn HeaderText="OrderID" UniqueName="OrderID" SortExpression="OrderID" 
                        Visible="false">  
                        <ItemTemplate> 
                            <asp:Label ID="lblOrderID" runat="server" Text='<%# Bind("OrderID") %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn HeaderText="Business Number" UniqueName="BusinessListingNumber" 
                        SortExpression="BusinessListingNumber">  
                        <ItemTemplate> 
                            <asp:Label ID="lblBusinessListingNumber" runat="server" Text='<%# Bind("BusinessListingNumber") %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridBoundColumn DataField="SlideID" DataType="System.Char" HeaderText="SlideID" 
                        ReadOnly="True" SortExpression="SlideID" UniqueName="SlideID">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridTemplateColumn HeaderText="FileName" UniqueName="FileName" SortExpression="FileName" 
                        Visible="false">  
                        <ItemTemplate> 
                            <asp:Label ID="lblFileName" runat="server" Text='<%# Bind("FileName") %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn HeaderText="Title" UniqueName="Title" SortExpression="Title">  
                        <ItemTemplate> 
                            <asp:Label ID="lblTitle" runat="server" Text='<%# Bind("Title") %>' /> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("Title") %>' /><br /> 
                            <asp:RequiredFieldValidator ID="Requiredfieldvalidator1" runat="server" ControlToValidate="txtTitle" 
                                ErrorMessage="Please, enter a Title!" Display="Dynamic" SetFocusOnError="true" /> 
                        </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn HeaderText="Description" UniqueName="Description" SortExpression="Description">  
                        <ItemTemplate> 
                            <asp:Label ID="Label1" runat="server" Text='<%# TrimDescription(DirectCast(IIF(Eval("Description") IsNot DBNull.Value,Eval("Description"),string.Empty),String)) %>' /> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:TextBox ID="txtDescription" runat="server" Text='<%# Bind("Description") %>' 
                                Width="350px" Height="50px" TextMode="MultiLine" /> 
                        </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridBinaryImageColumn DataField="ImageData" HeaderText="Slide" UniqueName="Upload" 
                        ImageAlign="NotSet" ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" DataAlternateTextField="Description" 
                        DataAlternateTextFormatString="Image of {0}">  
                        <HeaderStyle Width="10%" /> 
                    </telerik:GridBinaryImageColumn> 
                    <telerik:GridEditCommandColumn> 
                    </telerik:GridEditCommandColumn> 
                </Columns> 
                <EditFormSettings CaptionFormatString="Update Slide Info for SlideID: {0}" CaptionDataField="SlideID" 
                    FormCaptionStyle-Font-Bold="true" PopUpSettings-Modal="true" PopUpSettings-Height="250" 
                    PopUpSettings-Width="450px">  
                    <EditColumn UniqueName="EditCommandColumn1" ButtonType="PushButton">  
                    </EditColumn> 
                    <FormCaptionStyle Font-Bold="True"></FormCaptionStyle> 
                    <PopUpSettings Modal="True" Height="250px" Width="450px"></PopUpSettings> 
                </EditFormSettings> 
                <PagerStyle Mode="NextPrev" /> 
                <CommandItemTemplate> 
                    <table style="float: left; width: 100%;">  
                        <tr> 
                            <td style="text-align: left">  
                                <asp:Button ID="btnInsertNewRecord" runat="server" CommandName="InsertNewRecord" 
                                    Text="New Slide" Width="90px" Height="22px" /> 
                            </td> 
                            <td style="text-align: right">  
                                <asp:Button ID="btnRefresh" runat="server" CommandName="Refresh" Text="Refresh" Height="22px" /> 
                            </td> 
                        </tr> 
                    </table> 
                </CommandItemTemplate> 
            </MasterTableView> 
        </telerik:RadGrid> 
        </telerik:RadAjaxPanel>                                                    
            </div> 
        </div> 
                                
    <div style="float:left; width:100%;">      
    <table class="TableAddress" style="margin-bottom:5px;">      
    <tr><td class="TextLeft" colspan="3"><b>3. Categories:</b></td></tr> 
    <tr><td class="TextLeft" colspan="4">Add categories to each business listing</td></tr>  
    <tr><td class="TextRight" style="width:80px;">Categories:</td><td class="TextLeft"><asp:DropDownList ID="ddlCategory" runat="server" Width="125px" ToolTip="Select Category" AutoPostBack="True"></asp:DropDownList></td>  
    <td class="TextRight" style="width:110px;">Sub-Category 1:</td><td class="TextLeft"><asp:DropDownList ID="ddlSubCategory1" runat="server" Width="125px" ToolTip="Select Sub-Category 1" AutoPostBack="True"></asp:DropDownList></td>  
    <td class="TextRight" style="width:110px;">Sub-category 2:</td><td class="TextLeft"><asp:DropDownList ID="ddlSubCategory2" runat="server" Width="125px" ToolTip="Select Sub-Category 2"></asp:DropDownList></td>  
    </tr>      
    </table>        
    <br /> 
    <div style="float:left; margin-left:10px; margin-bottom:10px; margin-top:10px;">  
    <asp:Label ID="lblDuplicateCategory" runat="server" ForeColor="Red"></asp:Label> 
    </div> 
    <br /> 
    <div class="controlsdiv">  
      
 <%--       <telerik:RadAjaxPanel ID="rapCategory" runat="server" Width="100%">--%> 
            <telerik:RadGrid ID="rgCategory" runat="server" GridLines="None" Skin="Sunset" PageSize="8" 
            ClientSettings-Scrolling-SaveScrollPosition="true" AllowPaging="True">  
            <HeaderStyle HorizontalAlign="Left" /> 
            <ItemStyle HorizontalAlign="Left" /> 
            <AlternatingItemStyle HorizontalAlign="Left" /> 
            <ClientSettings EnablePostBackOnRowClick="true">  
                <Selecting AllowRowSelect="true" /> 
            </ClientSettings> 
            <PagerStyle Mode="NumericPages" /> 
            <MasterTableView PageSize="5" AutoGenerateColumns="False" DataKeyNames="ID" CommandItemDisplay="Top" 
                ShowHeadersWhenNoRecords="true" NoMasterRecordsText="Select Business Listing to Save Category.">  
                <Columns> 
                    <telerik:GridButtonColumn CommandName="DeleteRow" CommandArgument="DeleteRow" HeaderText="" 
                        Text="Delete" UniqueName="DeleteRow">  
                    </telerik:GridButtonColumn> 
                    <telerik:GridBoundColumn DataField="ID" DefaultInsertValue="" HeaderText="ID" SortExpression="ID" 
                        UniqueName="ID" DataType="System.Int16" ReadOnly="True" Visible="false">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="OrderID" DefaultInsertValue="" HeaderText="OrderID" 
                        SortExpression="OrderID" UniqueName="OrderID">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="BusinessListingNumber" DataType="System.Int16" 
                        DefaultInsertValue="" HeaderText="Business Number" SortExpression="BusinessListingNumber" 
                        UniqueName="BusinessListingNumber">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="MainCategory" DefaultInsertValue="" HeaderText="Category" 
                        SortExpression="MainCategory" UniqueName="MainCategory">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="SubCategory1" DefaultInsertValue="" HeaderText="Sub-Category 1" 
                        SortExpression="SubCategory1" UniqueName="SubCategory1">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="SubCategory2" DefaultInsertValue="" HeaderText="Sub-Category 2" 
                        SortExpression="SubCategory2" UniqueName="SubCategory2">  
                    </telerik:GridBoundColumn> 
                </Columns> 
                <PagerStyle Mode="NextPrev" /> 
                <CommandItemTemplate> 
                    <table style="float: left; width: 100%;">  
                        <tr> 
                            <td style="text-align: left">  
                                <asp:Button ID="btnSaveCategory" runat="server" CommandName="SaveCategory" Text="Save Category" 
                                    Width="105px" Height="25px" /> 
                            </td> 
                            <td style="text-align: right">  
                                <asp:Button ID="btnRefresh" runat="server" CommandName="Refresh" Text="Refresh" Height="25px" /> 
                            </td> 
                        </tr> 
                    </table> 
                </CommandItemTemplate> 
            </MasterTableView> 
        </telerik:RadGrid> 
<%--       </telerik:RadAjaxPanel>--%> 
          
        <asp:SqlDataSource ID="dsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" 
          SelectCommand="admin_Customers_BusinessListings_Categories_Select" SelectCommandType="StoredProcedure" 
           InsertCommand="admin_Customers_BusinessListings_Categories_Insert" InsertCommandType="StoredProcedure" 
           DeleteCommand="admin_Customers_BusinessListings_Categories_DeleteRow" DeleteCommandType="StoredProcedure">  
           <SelectParameters> 
           <asp:Parameter Name="OrderID" Type="String" /> 
           <asp:Parameter Name="BusinessListingNumber" Type="Int32" /> 
           <asp:Parameter Name="TabStripSelectedIndex" Type="Int32" /> 
           </SelectParameters> 
           <InsertParameters> 
           <asp:Parameter Name="OrderID" Type="String" /> 
           <asp:Parameter Name="BusinessListingNumber" Type="Int32" /> 
           <asp:Parameter Name="TabStripSelectedIndex" Type="Int32" /> 
           <asp:Parameter Name="MainCategory" Type="String" /> 
           <asp:Parameter Name="SubCategory1" Type="String" /> 
           <asp:Parameter Name="SubCategory2" Type="String" /> 
           </InsertParameters> 
           <DeleteParameters> 
           <asp:Parameter Name="ID" Type="Int32" /> 
           <asp:Parameter Name="OrderID" Type="String" /> 
           <asp:Parameter Name="BusinessListingNumber" Type="Int32" /> 
           <asp:Parameter Name="TabStripSelectedIndex" Type="Int32" /> 
           </DeleteParameters> 
        </asp:SqlDataSource> 
    </div> 
    </div>   


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
        If Not Page.IsPostBack Then  
            'Get querystring data  
            'Inst. queryencryption class  
            Dim QSD As New QueryStringEncryption  
 
            'Get UserName from query string  
            Dim UserNameEn As String  
            UserNameEn = Request.QueryString("un")  
            Me.Username = QSD.Decrypt(UserNameEn.Replace(" ", "+"))  
 
            'Get SalesID from query string  
            Dim CustIDEn As String  
            CustIDEn = Request.QueryString("cid")  
            Me.CustomerID = QSD.Decrypt(CustIDEn.Replace(" ", "+"))  
 
            'Create the OrderID  
            If Me.OrderID = String.Empty Then  
                'Create the OrderID for Business Listing with slides "WS"  
                Me.OrderID = CreateOrderID()  
            End If  
 
            'Display CustomerId and Username and set index for rad tab strip  
            lblCustomerID.Text = Me.CustomerID  
            lblUserName.Text = Me.Username  
            RadTabStripListings.SelectedIndex = 0 
 
            'Populate drop down lists: Category, States, Business hours, hotel star rating  
            GetMainCategory()  
            States()  
            BusinessHours()  
            StarRating()  
        End If  
    End Sub  
 
 
#Region "1. RadGrid Business Listings With Images Events."  
    Protected Sub rgListingWithImages_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgListingWithImages.ItemCommand  
        'Check which command name was selected  
        Select Case e.CommandName  
            Case "InsertNewRecord"  
                'Before inserting a new business listing check the strip index  
                If RadTabStripListings.SelectedIndex = 0 Then  
                    'Check if the OrderID exists  
                    If Not Me.OrderID = String.Empty Then  
                        'If OrderID exists tehn insert a new row into the BusinessListings table  
                        dsBusinessListings.InsertParameters("CustomerID").DefaultValue = Me.CustomerID  
                        dsBusinessListings.InsertParameters("OrderID").DefaultValue = Me.OrderID  
                        dsBusinessListings.InsertParameters("TabStripSelectedIndex").DefaultValue = RadTabStripListings.SelectedIndex  
                        'Get the Business Listing Description  
                        Dim BLD As New BusinessListingsPlanAndPricing  
                        dsBusinessListings.InsertParameters("BusinessListingDescription").DefaultValue = BLD.GetBusinessListingDescritpion(RadTabStripListings.SelectedIndex)  
                        dsBusinessListings.InsertParameters("WithSlideNoSlide").DefaultValue = "WS" 
                        'Call the Insert method  
                        dsBusinessListings.Insert()  
                        'Get data for the grid  
                        SelectGridWithImages()  
                        'Refresh the grid  
                        rgListingWithImages.Rebind()  
                    End If  
                End If  
                Exit Select  
            Case "DeleteRow"  
                'Clear error message  
                lblDuplicateCategory.Text = String.Empty  
 
                'Delete the selected row from the BusinessListing table  
                Dim myItem As GridDataItem = DirectCast(e.Item, GridDataItem)  
                Dim CustID As TableCell = myItem("CustomerID")  
                Dim OrdID As TableCell = myItem("OrderID")  
                Dim ListNo As TableCell = myItem("BusinessListingNumber")  
 
                'Fill delete parameters  
                dsBusinessListings.DeleteParameters("CustomerID").DefaultValue = CustID.Text  
                dsBusinessListings.DeleteParameters("OrderID").DefaultValue = OrdID.Text  
                dsBusinessListings.DeleteParameters("BusinessListingNumber").DefaultValue = CType(ListNo.Text, Integer)  
                dsBusinessListings.DeleteParameters("WithSlideNoSlide").DefaultValue = "WS" 
                dsBusinessListings.DeleteParameters("TabStripSelectedIndex").DefaultValue = RadTabStripListings.SelectedIndex  
                'Call delete method  
                dsBusinessListings.Delete()  
                'Get data for the the grid  
                rgListingWithImages.Rebind()  
 
                'Update the rgSlides grid after business listing row deleted  
                rgSlides.Rebind()  
                rgSlides.CurrentPageIndex = 0 
 
                'Update the Category grid  
                rgCategory.Rebind()  
                Exit Select  
        End Select  
    End Sub  
 
    Protected Sub rgListingWithImages_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles rgListingWithImages.PreRender  
        'To access a row in the rad grid  
        For Each myItem As GridDataItem In rgListingWithImages.Items  
            If myItem.Selected Then  
                'Use the column UniqueName (category description) to access the cell and get its text  
                Dim CustID As String = myItem("CustomerID").Text  
                Dim OrdID As String = myItem("OrderID").Text  
                Dim ListNo As String = myItem("BusinessListingNumber").Text  
 
                Me.CustomerID = CustID 
                Me.OrderID = OrdID 
                Me.BusinessListingNumber = CType(ListNo, Integer)  
 
                'Refresh the Slides grid depending on what row is selected  
                'dsSlides.SelectParameters("CustomerID").DefaultValue = Me.CustomerID  
                'dsSlides.SelectParameters("OrderID").DefaultValue = Me.OrderID  
                'dsSlides.SelectParameters("BusinessListingNumber").DefaultValue = Me.BusinessListingNumber  
                SelectGridSlides()  
                rgSlides.Rebind()  
 
                ''Update the Category grid  
                ''Refresh the Category grid depending on what row is selected  
                ''This is a basic select statement to fill the grid with data  
                ' ''dsCategory.SelectParameters("OrderID").DefaultValue = Me.OrderID  
                ' ''dsCategory.SelectParameters("BusinessListingNumber").DefaultValue = Me.BusinessListingNumber  
                ' ''dsCategory.SelectParameters("TabStripSelectedIndex").DefaultValue = RadTabStripListings.SelectedIndex  
                SelectGridCategory()  
                rgCategory.Rebind()  
            End If  
        Next  
    End Sub  
 
    Protected Sub rgListingWithImages_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgListingWithImages.NeedDataSource  
        'when page loads insert blank data into the grid or call the dsBusinessListings datasource  
        'Note: the DatasourceID in the aspx markup needs to be removed  
        If Not Page.IsPostBack Then  
            rgListingWithImages.DataSource = New String() {}  
        Else  
            rgListingWithImages.DataSourceID = "dsBusinessListings" 
        End If  
    End Sub  
 
    Protected Sub rgListingWithImages_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles rgListingWithImages.PageIndexChanged  
        rgListingWithImages.Rebind()  
    End Sub  
 
    Protected Sub rgListingWithImages_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rgListingWithImages.SelectedIndexChanged  
        'Return slides grid to the 1st page  
        rgSlides.CurrentPageIndex = 0 
    End Sub  
 
    Private Sub SelectGridWithImages()  
        'Check if OrderID exists  
        If Not Me.OrderID = String.Empty Then  
            'This is a basic select statement to fill the grid with data  
            dsBusinessListings.SelectParameters("CustomerID").DefaultValue = Me.CustomerID  
            dsBusinessListings.SelectParameters("OrderID").DefaultValue = Me.OrderID  
            dsBusinessListings.SelectParameters("WithSlideNoSlide").DefaultValue = "WS" 
        End If  
    End Sub  
#End Region  
 
 
#Region "RadGrid Slides Events."  
    Protected Sub rgSlides_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgSlides.ItemCommand  
        'Check which command name was selected  
        Select Case e.CommandName  
            Case "InsertNewRecord"  
                'Check if Business Listing is selected  
                If Not CStr(rgListingWithImages.SelectedValue) = String.Empty Then  
                    'Insert a new row into the BusinessListings table  
                    dsSlides.InsertParameters("CustomerID").DefaultValue = Me.CustomerID  
                    dsSlides.InsertParameters("OrderID").DefaultValue = Me.OrderID  
                    dsSlides.InsertParameters("BusinessListingNumber").DefaultValue = Me.BusinessListingNumber  
                    'Call the Insert method  
                    dsSlides.Insert()  
 
                    'Update the RadGrid Business Listings grid  
                    SelectGridWithImages()  
                    rgListingWithImages.Rebind()  
                End If  
                Exit Select  
            Case "DeleteRow"  
                'Delete the selected row from the BusinessListing table  
                Dim myItem As GridDataItem = DirectCast(e.Item, GridDataItem)  
                'Get the values out of the grid template fields - the template columns are not visible in the Edit form  
                Dim CustID As String = TryCast(myItem("CustomerID").FindControl("lblCustomerID"), Label).Text  
                Dim OrdID As String = TryCast(myItem("OrderID").FindControl("lblOrderID"), Label).Text  
                Dim ListNo As String = TryCast(myItem("BusinessListingNumber").FindControl("lblBusinessListingNumber"), Label).Text  
                'Dim SlideID As String = TryCast(myItem("SlideID").FindControl("lblSlideID"), Label).Text  
                'Get the value of the GridBoundColumn selected SlideID  
                Dim SlideID As String  
                Dim row As GridDataItem = DirectCast(e.Item, GridDataItem)  
                SlideID = row("SlideID").Text  
 
                'Fill delete parameters  
                dsSlides.DeleteParameters("CustomerID").DefaultValue = CustID 
                dsSlides.DeleteParameters("OrderID").DefaultValue = OrdID 
                dsSlides.DeleteParameters("BusinessListingNumber").DefaultValue = CType(ListNo, Integer)  
                dsSlides.DeleteParameters("SlideID").DefaultValue = SlideID 
 
                'Call delete method  
                dsSlides.Delete()  
                'Get data for the the grid  
                rgSlides.Rebind()  
 
                'Update the RadGrid Business Listings grid  
                SelectGridWithImages()  
                rgListingWithImages.Rebind()  
                Exit Select  
        End Select  
    End Sub  
 
    Protected Sub rgSlides_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgSlides.ItemCreated  
        If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then  
            Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)  
            Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl  
            Dim validator As CustomValidator = New CustomValidator()  
            validator.ErrorMessage = "Select image file to upload." 
            validator.ClientValidationFunction = "validateRadUpload" 
            validator.Display = ValidatorDisplay.Dynamic  
            DirectCast(upload.Parent, TableCell).Controls.Add(validator)  
        End If  
    End Sub  
 
    Protected Sub rgSlides_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgSlides.ItemDataBound  
        If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then  
            Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)  
            Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl  
            RadAjaxPanel1.ResponseScripts.Add(String.Format("window['UploadId'] = '{0}';", upload.ClientID))  
        End If  
    End Sub  
 
    Protected Function TrimDescription(ByVal description As String) As String  
        If Not String.IsNullOrEmpty(description) AndAlso description.Length > 200 Then  
            Return String.Concat(description.Substring(0, 200), "...")  
        End If  
        Return description  
    End Function  
 
    Protected Sub rgSlides_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgSlides.NeedDataSource  
        'When page loads insert blank data into the grid or call the dsBusinessListings datasource  
        'Note: the DatasourceID in the aspx markup needs to be removed  
        If Not Page.IsPostBack Then  
            rgSlides.DataSource = New String() {}  
        Else  
            rgSlides.DataSourceID = "dsSlides" 
        End If  
    End Sub  
 
    Protected Sub rgSlides_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles rgSlides.PageIndexChanged  
        rgSlides.Rebind()  
    End Sub  
 
    Private Sub SelectGridSlides()  
        'Check if the OrderID exists  
        If Not Me.OrderID = String.Empty Then  
            'This is a basic select statement to fill the grid with data  
            dsSlides.SelectParameters("CustomerID").DefaultValue = Me.CustomerID  
            dsSlides.SelectParameters("OrderID").DefaultValue = Me.OrderID  
            dsSlides.SelectParameters("BusinessListingNumber").DefaultValue = Me.BusinessListingNumber  
        End If  
    End Sub  
#End Region  
 
 
#Region "RadGrid Category Item Events"  
    Protected Sub rgCategory_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgCategory.ItemCommand  
        'Check which command name was selected  
        Select Case e.CommandName  
            Case "SaveCategory"  
                'Clear error message  
                lblDuplicateCategory.Text = String.Empty  
 
                'Set up bit to check for duplicate categories  
                Dim DupCat As Boolean = False 
 
                'Check if a Business Listing and the Main Category is selected  
                If Not CStr(rgListingWithImages.SelectedValue) = String.Empty AndAlso Not CStr(ddlCategory.SelectedValue) = String.Empty Then  
                    'Checking for duplicated categories  
                    DupCat = CheckForDuplicateCategories(DupCat)  
 
                    'Determin status of selected category. Eg: duplicate or non-duplicate category  
                    If DupCat Then  
                        'If category duplicated then exit  
                        Exit Select  
                    Else  
                        'If category not duplicated then insert new Category into Categories table  
                        'Default parameters  
                        dsCategory.InsertParameters("OrderID").DefaultValue = Me.OrderID  
                        dsCategory.InsertParameters("BusinessListingNumber").DefaultValue = Me.BusinessListingNumber  
                        dsCategory.InsertParameters("TabStripSelectedIndex").DefaultValue = RadTabStripListings.SelectedIndex  
                        'Data parameters  
                        dsCategory.InsertParameters("MainCategory").DefaultValue = ddlCategory.SelectedValue.ToString.Trim  
                        dsCategory.InsertParameters("SubCategory1").DefaultValue = ddlSubCategory1.SelectedValue.ToString.Trim  
                        dsCategory.InsertParameters("Subcategory2").DefaultValue = ddlSubCategory2.SelectedValue.ToString.Trim  
                        'Call insert method  
                        dsCategory.Insert()  
 
                        'Update the Category grid  
                        SelectGridCategory()  
                        rgCategory.Rebind()  
 
                        'Update the Business Listings with images grid  
                        rgListingWithImages.Rebind()  
                    End If  
                End If  
                Exit Select  
 
                'Reset the duplicate category bit  
                DupCat = False 
            Case "DeleteRow"  
                'Clear error message  
                lblDuplicateCategory.Text = String.Empty  
 
                'Delete the selected row from the BusinessListing table  
                Dim myItem As GridDataItem = DirectCast(e.Item, GridDataItem)  
                'Get values of GridBound data items  
                Dim ID As String = myItem("ID").Text  
                Dim OrderID As String = myItem("OrderID").Text  
                Dim ListNo As String = myItem("BusinessListingNumber").Text  
 
                'Fill delete parameters  
                dsCategory.DeleteParameters("ID").DefaultValue = ID 
                dsCategory.DeleteParameters("OrderID").DefaultValue = OrderID 
                dsCategory.DeleteParameters("BusinessListingNumber").DefaultValue = CInt(ListNo)  
                dsCategory.DeleteParameters("TabStripSelectedIndex").DefaultValue = RadTabStripListings.SelectedIndex  
                'Call delete method  
                dsCategory.Delete()  
 
                'Update the Business Listings with images grid  
                rgListingWithImages.Rebind()  
 
                'Update the Category grid  
                rgCategory.Rebind()  
                Exit Select  
        End Select  
 
        'Clear out categories and then refill main category  
        ResetCategories()  
        GetMainCategory()  
    End Sub  
 
    Protected Sub rgCategory_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgCategory.NeedDataSource  
        'When page loads insert blank data into the grid or call the dsCategories datasource  
        'Note: the DatasourceID in the aspx markup needs to be removed  
        If Not Page.IsPostBack Then  
            rgCategory.DataSource = New String() {}  
        Else  
            'rgCategory.DataSourceID = "dsCategory" 
            Dim Cat As New BusinessListingsPlanAndPricing  
            rgCategory.DataSource = Cat.CategorySelect(Me.OrderID, Me.BusinessListingNumber, RadTabStripListings.SelectedIndex)  
        End If  
    End Sub  
 
    Protected Sub rgCategory_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles rgCategory.PageIndexChanged  
        rgCategory.Rebind()  
    End Sub  
 
    Private Sub SelectGridCategory()  
        If Not Me.OrderID = String.Empty Then  
            ''This is a basic select statement to fill the grid with data  
            'dsCategory.SelectParameters("OrderID").DefaultValue = Me.OrderID  
            'dsCategory.SelectParameters("BusinessListingNumber").DefaultValue = Me.BusinessListingNumber  
            'dsCategory.SelectParameters("TabStripSelectedIndex").DefaultValue = RadTabStripListings.SelectedIndex  
 
            Dim Cat As New BusinessListingsPlanAndPricing  
            rgCategory.DataSource = Cat.CategorySelect(Me.OrderID, Me.BusinessListingNumber, RadTabStripListings.SelectedIndex)  
        End If  
    End Sub  
 
    Private Sub ResetCategories()  
        ddlCategory.Items.Clear()  
        ddlSubCategory1.Items.Clear()  
        ddlSubCategory2.Items.Clear()  
    End Sub  
 
    Private Function CheckForDuplicateCategories(ByVal DuplicateBit As Boolean) As Boolean  
        'Create integer values for each drop down list and sum them  
        Dim ddlCat, ddlSubCat1, ddlSubCat2 As Integer  
        'Add 1 if drop down list is selecetd  
        If Not ddlCategory.SelectedValue = String.Empty Then  
            ddlCat = 1 
        End If  
        If Not ddlSubCategory1.SelectedValue = String.Empty Then  
            ddlSubCat1 = 1  
        End If  
        If Not ddlSubCategory2.SelectedValue = String.Empty Then  
            ddlSubCat2 = 1 
        End If  
        'Sum values  
        Me.CategoryTotals = ddlCat + ddlSubCat1 + ddlSubCat2  
 
        'Check how many drop down list have been selected and then check for duplicate categories  
        Select Case Me.CategoryTotals  
            Case 1  
                For Each CatItem As GridDataItem In rgCategory.Items  
                    'Get each value in the Main Category  
                    Dim Cat As String = CatItem("MainCategory").Text  
                    'Check if it is the same as the selected value  
                    If Cat.Trim = ddlCategory.SelectedValue.ToString.Trim Then  
                        DuplicateBit = True 
                        lblDuplicateCategory.Text = "<b>The category: " & ddlCategory.SelectedValue.ToString.Trim.ToUpper & " you are trying to add already exists.</b>"  
                        Exit For  
                    End If  
                Next  
                Exit Select  
            Case 2  
                For Each SubCat1 As GridDataItem In rgCategory.Items  
                    'Get each value in Sub-Category 1  
                    Dim Sub1 As String = SubCat1("SubCategory1").Text  
                    'Check if it is the same as the selected value  
                    If Sub1.Trim = ddlSubCategory1.SelectedValue.ToString.Trim Then  
                        DuplicateBit = True 
                        lblDuplicateCategory.Text = "<b>The Sub-Category 1: " & ddlSubCategory1.SelectedValue.ToString.Trim.ToUpper & " you are trying to add already exists.</b>"  
                        Exit For  
                    End If  
                Next  
                Exit Select  
            Case 3  
                For Each SubCat2 As GridDataItem In rgCategory.Items  
                    'Get each value in Sub-Category 2  
                    Dim Sub2 As String = SubCat2("SubCategory2").Text  
                    'Check if it is the same as the selected value  
                    If Sub2.Trim = ddlSubCategory2.SelectedValue.ToString.Trim Then  
                        DuplicateBit = True 
                        lblDuplicateCategory.Text = "<b>The Sub-Category 2: " & ddlSubCategory2.SelectedValue.ToString.Trim.ToUpper & " you are trying to add already exists.</b>"  
                        Exit For  
                    End If  
                Next  
                Exit Select  
        End Select  
        Return DuplicateBit  
    End Function  
#End Region 


Thanks

Chommy

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Mar 2010, 12:22 PM
Hi,

I have noticed from your design that  you have used both  RadAjaxPanel  and RadAjaxManger. The Telerik team has documented this error stating the cause to be the  use of both the controls at the same time .Please  take a look at the link below :
Receiving Sys.WebForms.PageRequestManagerParserErrorException

Princy
0
Chom
Top achievements
Rank 1
answered on 12 Mar 2010, 07:03 PM
Hi Princy

Thanks for your help. I have removed the ajax manager and have wrapped an ajax panel around everything in the page. All is working well however the binary image upload in the 2nd grid is causing some errors.

I used the RadAjaxPanel1 that was wrapped aroung the rgSlides grid. This call a javascript event and is the code used from the RadBinary image example http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=binaryimage

Here are some images of teh problem. when the grid is in EditMode I used a popup window to add the images and I have also changed the grid to Edit Forms. However the problem still persists. I captured a screen shot of the problem. What happens is when I mouseover the Select button a text box with a browse button appears and when i click on the Select button to open the dialog to upload a file, the dialog doe not open.




Tags
Grid
Asked by
Chom
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Chom
Top achievements
Rank 1
Share this question
or