Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
79 views
Hey everyone,

I am a little new to your product, however, I am trying to use one of your controls in place of the above mentioned class. The problem I am having is there is some 3rd party code that looks like this...

public void PopulateStoreMenu(Menu ctrlMenu); 

As you can tell it adds all the information to the Menu object. Now assuming I don't have access to the source code is there a way to...

A.) Use a control that extends the Menu class

or

B.) Bind data to the control some other way

I was thinking maybe I could use Linq on the Menu and bind it to that, however, I am a Linq newbie so advice would need to be given.

Thanks in advance guys!

Jackie

P.S. I posted this here because I wasn't sure which control to post it under :-)


Jackie Gleason
Top achievements
Rank 1
 asked on 14 Mar 2010
2 answers
165 views
Hi,

I'm using your griddropdowncolumn very nicelly, but realized there's a problem with the filtered field it uses by default.
Facts:
  • have 2 tables related in grid
  • one table named Table  with these columns IDTable, TableDesc, IDForeign
  • my foreign table is called Foreign and has IDForeign and ForeignDesc columns
  • columns in Grid are: TableDesc (GridBoundColumn) and ForeignDesc(GridDropDownColumn)
  • grid alows filtering
  • Filter works fine in column TableDesc but NOT in ForeignDesc

If you insert data in both tables and try to filter by any content in the ForeignDesc column it doesn't return anything, it only works if you use the IDForeign content in the filter. It should be possible to use the ForeignDesc content for filtering the data, no?
What am I doing wrong? Here's what I have.
 

<telerik:RadGrid ID="rdTableForeign" runat="server" DataSourceID="sdsTable" AllowPaging="True" 
        ShowFooter="True" AutoGenerateColumns="False" AllowSorting="True" EnableViewState="true" 
        AllowFilteringByColumn="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="True">  
        <GroupingSettings CaseSensitive="false" /> 
        <MasterTableView DataKeyNames="IDTable" AutoGenerateColumns="false" AllowMultiColumnSorting="True" 
            EnableViewState="true" EnableColumnsViewState="true">  
            <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" /> 
            <Columns> 
                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" ButtonType="ImageButton">  
                    <ItemStyle Width="50px" /> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridBoundColumn DataField="TableDesc" HeaderText="Description" UniqueName="TableDesc" DataType="System.String">  
                </telerik:GridBoundColumn> 
                <telerik:GridDropDownColumn DataSourceID="dsForeign" ListTextField="ForeignDesc" 
                    AllowFiltering="true" ListValueField="IDForeign" UniqueName="GridDropDownColumn" 
                    SortExpression="ForeignDesc" HeaderText="Foreign" DropDownControlType="RadComboBox" 
                    DataField="IDForeign" DataType="System.String">  
                </telerik:GridDropDownColumn> 
            </Columns> 
            <EditFormSettings> 
                <EditColumn ButtonType="ImageButton" /> 
            </EditFormSettings> 
        </MasterTableView> 
        <ClientSettings> 
            <Resizing AllowColumnResize="true" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="sdsTable" ConnectionString="<%$ ConnectionStrings:MyConnection %>" 
        SelectCommand="SELECT * FROM [Table]" runat="server" UpdateCommand="wcspTableUpdate" 
        UpdateCommandType="StoredProcedure">  
        <UpdateParameters> 
            <asp:Parameter Name="IDTable" Type="Int32" /> 
            <asp:Parameter Name="TableDesc" Type="Int32" /> 
        </UpdateParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource runat="server" ID="dsForeign" ConnectionString="<%$ ConnectionStrings:MyConnection %>" 
        SelectCommand="SELECT [IDForeign], [ForeignDesc] FROM [Foreign]"></asp:SqlDataSource> 

 

 

 

Thanks for any help!

Tauz

Tauz
Top achievements
Rank 1
 answered on 13 Mar 2010
1 answer
171 views
Hello,

I have a really strange problem.

I'm working with the Q1 2010.

I want to use the RadListView as a list of news. With a pagesize of 1 and the newest post first. So i put in my asp:EntityDataSource :OrderBy="it.Date DESC"

<telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="IdPost"  
        DataSourceID="EntityDataSourceNews" AllowPaging="True" ItemPlaceholderID="itemPlaceholder"  InsertItemPosition="None" 
        OnItemCommand="RadListView1_ItemCommand" PageSize="1"
        <LayoutTemplate> 
             
            <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> 
             
            <br /> 
 
            <telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="1"
                <Fields> 
                    <telerik:RadDataPagerSliderField /> 
                </Fields> 
            </telerik:RadDataPager> 
 
            <br /> 
 
            <asp:Button ID="btnInitInsert" runat="server" Text="Ajouter une news" onclick="btnInitInsert_Click" /> 
 
        </LayoutTemplate> 
<ItemTemplate> 
            <div id="Historique" class="ui-widget-content ui-corner-all">  
                <h2 class="ui-widget-header ui-corner-all"
                    <div style="float:right; font-size:10px"
                        <img src="/Images/famfamfam/date.png" /><em><%# Eval("Date") %></em
                    </div> 
                    <%# Eval("Titre") %> 
                </h2>  
                <class="borbot"
                    <%# Eval("PostContent") %> 
                </p> 
                 
                <div style="float:right; margin-right:5px"
                    <asp:ImageButton ID="DeleteButton" runat="server" CommandName="Delete"  
                        CssClass="rlvBDel" Text="Supprimer" ImageUrl="~/Images/famfamfam/Delete.gif" /> 
                </div> 
                <asp:ImageButton ID="EditButton" runat="server" CommandName="Edit"  
                    CssClass="rlvBEdit" Text="Editer" ImageUrl="~/Images/famfamfam/Edit.gif" /> 
                <br /> 
            </div> 
        </ItemTemplate> 
</telerik:RadListView> 
 
<asp:EntityDataSource ID="EntityDataSourceNews" runat="server"  
        ConnectionString="name=PortailEntrepriseEntities"  
        DefaultContainerName="PortailEntrepriseEntities" EnableDelete="True"  
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True"  
        EntitySetName="Posts" OnInserting="EntityDataSourceNews_Inserting" 
        OrderBy="it.Date DESC"
    </asp:EntityDataSource> 
 


The thing is that the first item which appear, is the oldest one ! (So it's not working)
But, if i go to the page 2, then come back to the page 1 it's the newest one !

I mist something ? 

Thank you
Jean-Yves
Top achievements
Rank 1
 answered on 13 Mar 2010
1 answer
103 views
I am using a RadGrid with an embedded RadComboBox, using the Default skin. I'm tight for space so I overrode the styles for the RadGrid to reclaim some space as below:

div.Ironwood.RadGrid_Default .rgFooter td 
    border-bottom:0px
    padding-left:4px!important; 
    padding-right:4px!important; 
div.ManagersInTheNews.RadGrid_Default .rgRow, 
div.ManagersInTheNews.RadGrid_Default .rgAltRow, 
div.ManagersInTheNews.RadGrid_Default .rgRow td, 
div.ManagersInTheNews.RadGrid_Default .rgAltRow td 
    font-family:Arial
    font-size:11px
    border-bottom:0px!important; 
    vertical-align:middle!important; 
    padding-left:4px!important; 
    padding-right:4px!important; 
 

I am also adding the RadComboBox to the bottom row (added programmatically). Without the overrides for the paddings, it appears normal, however with the overrides, it appears as in the attached image. Is there something I can do to get the background image to align better?

Thanks, Steve


robertw102
Top achievements
Rank 1
 answered on 13 Mar 2010
1 answer
149 views
Hi

I had the following Server Error after including a RadAjaxManager to a Webpage:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

In many forums they said to be sure to remove all code blocks (<% %>) in the Head-Section of the Page.
Or delete the runat="server" from the Head-Section.

Noting helped in my case. But the ting with the code blocks helped me find it out.
It had nothing to do with the Head-Section of the Page or the Master-Page.

I simply had to remove the code blocks IN my page.

That's the page-code that produces the Error:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CollectionModifyProblem._Default" %> 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
 
<head runat="server">  
 
<title>Untitled Page</title> 
 
</head> 
 
<body> 
 
<form id="form1" runat="server">  
 
 
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
 
</telerik:RadScriptManager> 
 
 
<div> 
 
 
<%="Select a Brand (norally I use a var here):"%> 
 
<telerik:RadListBox ID="lstbBrands" runat="server"></telerik:RadListBox> 
 
 
<%="Select a Type: (norally I use a var here)"%> 
 
<telerik:RadListBox ID="lstbCarTypes" runat="server"></telerik:RadListBox> 
 
 
</div> 
 
 
<telerik:RadAjaxManager runat="server">  
 
<AjaxSettings> 
 
<telerik:AjaxSetting AjaxControlID="lstbBrands">  
 
<UpdatedControls> 
 
<telerik:AjaxUpdatedControl ControlID="lstbCarTypes" /> 
 
</UpdatedControls> 
 
</telerik:AjaxSetting> 
 
</AjaxSettings> 
 
</telerik:RadAjaxManager> 
 
 
</form> 
 
 
</body> 
 
</html> 

After a while I replaced the two code-blocks with labels:

<%="Select a Brand (norally I use a var here):"%> 
to  
<asp:Label runat="server" ID="lblTitle_Brands">Select a Brand (noraly I fill this by code):</asp:Label> 

and

<%="Select a Type (norally I use a var here):"%> 
to  
<asp:Label runat="server" ID="lblTitle_Type">Select a Type (noraly I fill this by code):</asp:Label> 

That's all you have to do!

Maybe this will help also others!

Freundliche Grüsse
Marcel

robertw102
Top achievements
Rank 1
 answered on 13 Mar 2010
2 answers
89 views
Hi

I am trying to move away from using table layout in my web applications. I am busy implementing the "Grid/Form Template Edit Form" Grid example and noticed that the FormTemplate is using a table layout. Is this the recommended way or is this for illustration purpose only? What would be the correct way to implement the FormTemplate?
 
Thank You 
Fred  
Fred Mare
Top achievements
Rank 1
 answered on 13 Mar 2010
2 answers
165 views
Hello,

I'm having problems deploying my application, and I suspect it is because I'm running IIS 7 on my development machine, and the production server is running IIS 6.

The problem manifests as the tabstrip not responding to clicks, and in IE I get the following javascript error on page load:
Error: 'Sys.WebForms.PageRequestManager' is null or not an object 

Somewhere I read that IIS 6 cannot read the <system.webServer> section of a web.config, and I can see I have that section.

Could someone please point me in the right direction as to the IIS 6 compatible sections on a web.config ?



Max Figueredo
Top achievements
Rank 1
 answered on 12 Mar 2010
5 answers
302 views
Hi I have a RadDock and a ContentTemplate. There is a gap between the content and the container on the left, right and bottom edges.

How do I remove this gap? Thanks!

<

 

telerik:RadDock ID="RadDock4" runat="server" Width="100%" Title="<span class=RadDockTitleBar>Online Correspondence</span>" EnableEmbeddedSkins="false" Skin="REMDefault">

 

 

<ContentTemplate>

 

 

<div style="background-color:Blue;margin:0px;padding:0px">TEST</div>

 

 

</ContentTemplate>

 

 

</telerik:RadDock>

 

mamad
Top achievements
Rank 2
 answered on 12 Mar 2010
2 answers
423 views
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

Chom
Top achievements
Rank 1
 answered on 12 Mar 2010
7 answers
261 views
Hi,

I have been trying to set the dock.OnClientInitialize property in  a loop  dynamically in my code behind.

I am looping through my data source to find how many docks I need to dinacally ad to the zones... I also need to set the OnClientInitialize property inside the same loop.

I though i had it figure out in my javascript that also does some loop but... no matter what I do I always get the "dock has no properties" error message.

Do you have any suggestion on how to do this? If I cold pass the dock id as a parameter it would help but the OnClientInitialize asks for a property and not a method.

Any suggestions?

Thanks,

Adriano
Rambo the Dog
Top achievements
Rank 1
 answered on 12 Mar 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?