Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
171 views
Hi. Is it possible to expand a hierarchical grid via a hyperlink column? I noticed you can create a GridExpandColumn but I need a DataField or value instead of the expand arrow, hopefully a hyperlink of some sort. Also, if this is possible, how do I hide the default expand column for just that grid and not any other? Thanks.

Daniel
Doug
Top achievements
Rank 1
 answered on 23 Aug 2011
2 answers
100 views
Hey Guys,
Got a small problem with my radGrid.
I'm using a pdf production component to produce pdf output from a byte stream.
I launch this method from a standard button click and the pdf is streamed to the browser.
However, when I attempt this from a Button column in my radGrid, the call errors with:

"Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this
are when the response is modified by calls to Response.Write(), response filters, HttpModules or server trace is enabled"

Which makes sense because I'm intercepting the response and setting content-type, adding headers and BinaryWriting the data.

So as this works just fine outside of the RadGrid, is there something I can do to make the request happy with with calling it from within? I really need to bind things from the current row to make the call.

Many thanks
Mark.

Simon
Top achievements
Rank 1
 answered on 23 Aug 2011
2 answers
76 views
I had an ASP.NET AJAX solution with a somewhat recent version of Telerik installed (earlier this year). I just upgraded to the latest version and now when I run the project none of my web forms render. I can't even catch a break point and the page load event. I get just an empty web page if any Telerik controls are present. web forms without Telerik controls work fine. If I create a new project everything works fine. I tried doing the upgrade on my project and that had no effect. My web.config doesn't specify any specific version and I tried creating a new web.config and that had no effect.

Any ideas what the problem may be?
Steve
Top achievements
Rank 1
 answered on 22 Aug 2011
2 answers
96 views
Hello, I have a ajaxloadingpanel setup for an ajaxpanel. Whenever it loads it does not stop. I put a break point at the end of my code behind and verify that it reaches it. I haven't seen this one before. Anyone know what could be happening?

Thanks,
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataMigration.ascx.cs"
    Inherits="PDS.DataMigration1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<style type="text/css">
    .style8
    {
        color: #FFFFFF;
    }
</style>
<script type="text/javascript">
    //    function onItemChecked(sender, e) 
    //    {
    //        var item = e.get_item();
    //        var items = sender.get_items();
    //        var checked = item.get_checked();
    //        var firstItem = sender.getItem(0);
    //        if (item.get_text() == "Select All") 
    //        {
    //            items.forEach(function (itm) { itm.set_checked(checked); });
    //        }
    //        else 
    //        {
    //            if (sender.get_checkedItems().length == items.get_count() - 1) 
    //            {
    //                firstItem.set_checked(!firstItem.get_checked());
    //            }
    //        }
    //    }
  
  
   
  
</script>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<div style="text-align: center; width: 100%">
    <div style="text-align: left">
        <div style="text-align: center; width: 500px; margin-top: 40px">
            <%--<asp:Panel ID="Panel1" runat="server" Width="450px" Height="450px" BackColor="#62768A">--%>
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="445px" BackColor="#62768A">
                <span class="style8">
                    <label>
                        Select Dealership</label></span>
                <br />
                <telerik:RadComboBox runat="server" ID="rcb_Dealerships" Width="200px" AutoPostBack="true"
                    EnableEmbeddedSkins="false" OnDataBinding="rcb_Dealerships_DataBinding" OnSelectedIndexChanged="rcb_Dealerships_SelectedIndexChanged">
                </telerik:RadComboBox>
                <br />
                <br />
                <span class="style8">
                    <label style="text-align: left">
                        Select Accounts</label></span>
                <br />
                <telerik:RadListBox ID="rlb_Accounts" runat="server" Width="400px" Height="300px"
                    CheckBoxes="true" EnableEmbeddedSkins="false" BackColor="#E1EAF2" BorderColor="#E1EAF2"
                    Style="text-align: left" AutoPostBack="True" SelectionMode="Multiple">
                </telerik:RadListBox>
                <br />
                <br />
                <telerik:RadButton ID="rb_Migrate" runat="server" Width="150px" Text="Migrate Accounts"
                    Skin="WebBlue" BackColor="#33393E" ForeColor="Black" OnClick="rb_Migrate_Click">
                </telerik:RadButton>
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableEmbeddedSkins="false">
                </telerik:RadWindowManager>
                <br />
            </telerik:RadAjaxPanel>
            <%--</asp:Panel>--%>
        </div>
    </div>
    <div style="width: 100%; margin-top: 40px; text-align: left">
        <div style="text-align: left; width: 1000px; margin-left: 25px">
            <asp:Panel Width="100%" Height="575px" runat="server" BackColor="#62768A" Style="text-align: center"
                ID="GridPanel">
                <div style="text-align: left; margin-left: 25px">
                    <telerik:RadButton ID="UpdateMigrationData" runat="server" Text="Update Migration Data"
                        Skin="WebBlue" OnClick="UpdateMigrationData_Click">
                    </telerik:RadButton>
                                       
                    <label id="PanelLabel" style="font-size: larger; color: White">
                        Please Categorize All New Products Before Migrating Users</label>
                </div>
                <div style="text-align: center; height: 450px; width: 90%">
                    <div style="text-align: center; width: 100%; margin-top: 50%">
                        <div style="text-align: left; width: 100%; background-color: #62768A; margin-top: -48%">
                            <telerik:RadGrid ID="RadGrid1" runat="server" Skin="WebBlue" DataSourceID="SessionDataSource1"
                                AllowPaging="true" AutoGenerateColumns="true" GridLines="Horizontal" PageSize="15"
                                AllowAutomaticUpdates="true" Visible="true" OnDataBound="RadGrid1_DataBound">
                                <MasterTableView AutoGenerateColumns="false" TableLayout="Fixed" Width="100%" EditMode="InPlace"
                                    DataKeyNames="UID">
                                    <SortExpressions>
                                        <telerik:GridSortExpression FieldName="productname" SortOrder="Descending" />
                                    </SortExpressions>
                                    <PagerStyle Visible="true" />
                                    <Columns>
                                        <telerik:GridTemplateColumn ColumnEditorID="DDEditor" HeaderText="pds#categoryNAME"
                                            Display="true" HeaderStyle-Width="140px" HeaderStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:Panel ID="Panel1" runat="server">
                                                    <telerik:RadButton ID="RadButton1" runat="server" Text="Save" AutoPostBack="true"
                                                        Skin="WebBlue" OnClick="RadButton1_Click">
                                                    </telerik:RadButton>
                                                       
                                                    <telerik:RadComboBox runat="server" ID="GridTemplateListbox" EnableEmbeddedSkins="false">
                                                        <Items>
                                                            <telerik:RadComboBoxItem Text="Service Contract" Value="1" />
                                                            <telerik:RadComboBoxItem Text="GAP" Value="2" />
                                                            <telerik:RadComboBoxItem Text="ETCH" Value="3" />
                                                            <telerik:RadComboBoxItem Text="Sealants" Value="4" />
                                                            <telerik:RadComboBoxItem Text="Tire and Wheel" Value="5" />
                                                            <telerik:RadComboBoxItem Text="Disability" Value="6" />
                                                            <telerik:RadComboBoxItem Text="Credit Life" Value="7" />
                                                            <telerik:RadComboBoxItem Text="Safe Lease" Value="8" />
                                                            <telerik:RadComboBoxItem Text="Crystal Fusion" Value="9" />
                                                            <telerik:RadComboBoxItem Text="Key" Value="10" />
                                                            <telerik:RadComboBoxItem Text="Finance" Value="11" />
                                                            <telerik:RadComboBoxItem Text="UPP" Value="12" />
                                                            <telerik:RadComboBoxItem Text="Maintenance" Value="13" />
                                                            <telerik:RadComboBoxItem Text="Retail Vehicle Sales" Value="14" />
                                                            <telerik:RadComboBoxItem Text="Total Vehicle Sales" Value="15" />
                                                            <telerik:RadComboBoxItem Text="Miscellaneous" Value="16" />
                                                            <telerik:RadComboBoxItem Text="Dent Repair" Value="17" />
                                                            <telerik:RadComboBoxItem Text="Liners" Value="18" />
                                                            <telerik:RadComboBoxItem Text="Electronic Theft Recovery" Value="19" />
                                                            <telerik:RadComboBoxItem Text="Window Tint" Value="20" />
                                                            <telerik:RadComboBoxItem Text="Tri Pac" Value="21" />
                                                            <telerik:RadComboBoxItem Text="Handsfree" Value="22" />
                                                            <telerik:RadComboBoxItem Text="ID Theft" Value="23" />
                                                            <telerik:RadComboBoxItem Text="Inactive" Value="24" />
                                                            <telerik:RadComboBoxItem Text="DigiShield" Value="26" />
                                                            <telerik:RadComboBoxItem Text="Anti-Theft" Value="27" />
                                                            <telerik:RadComboBoxItem Text="VIP" Value="28" />
                                                            <telerik:RadComboBoxItem Text="VSC Refund" Value="29" />
                                                            <telerik:RadComboBoxItem Text="Chip" Value="30" />
                                                            <telerik:RadComboBoxItem Text="Equity Protection" Value="31" />
                                                            <telerik:RadComboBoxItem Text="Accessories" Value="32" />
                                                        </Items>
                                                    </telerik:RadComboBox>
                                                </asp:Panel>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="UID" HeaderText="UID" SortExpression="UID" UniqueName="UID"
                                            Display="true" ReadOnly="true">
                                            <HeaderStyle Width="30px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="productname" HeaderText="productname" SortExpression="productname"
                                            UniqueName="productname" ReadOnly="true">
                                            <HeaderStyle Width="150px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="description" HeaderText="description" SortExpression="description"
                                            UniqueName="description" ReadOnly="true">
                                            <HeaderStyle Width="200px" />
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                            <telerik:GridDropDownListColumnEditor ID="DDEditor" runat="server" DropDownStyle-Width="100px">
                            </telerik:GridDropDownListColumnEditor>
                            <input id="categoryIDparameter" runat="server" visible="false" />
                            <input id="categoryNAMEparameter" runat="server" visible="false" />
                            <input id="UIDparameter" runat="server" visible="false" />
                            <asp:SqlDataSource ID="SessionDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:conn_pipiusers %>"
                                ProviderName="System.Data.SqlClient" SelectCommand="SELECT UID, userID, pds#categoryID, pds#categoryNAME, productname, description FROM [MENU_PRODUCTS_Coley_Translate] WHERE pds#categoryID = '99'"
                                OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [MENU_PRODUCTS_Coley_Translate] SET [pds#categoryID] = @pds#categoryID, [pds#categoryNAME] = @pds#categoryNAME WHERE [UID] = @UID">
                                <UpdateParameters>
                                    <asp:Parameter Name="pds#categoryID" Type="Int32" />
                                    <asp:Parameter Name="pds#categoryNAME" Type="String" />
                                    <asp:Parameter Name="UID" Type="Int32" />
                                </UpdateParameters>
                            </asp:SqlDataSource>
                        </div>
                    </div>
                </div>
            </asp:Panel>
            <%--<asp:SqlDataSource ID="SessionDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:conn_pipiusers %>"
                                ProviderName="System.Data.SqlClient" SelectCommand="SELECT UID, userID, pds#categoryID, pds#categoryNAME, productname, description FROM [MENU_PRODUCTS_Coley_Translate] WHERE pds#categoryID = '99'"
                                OldValuesParameterFormatString="original_{0}" 
                UpdateCommand="UPDATE [MENU_PRODUCTS_Coley_Translate] SET [pds#categoryID] = @pds#categoryID, [pds#categoryNAME] = @pds#categoryNAME WHERE [UID] = @UID" 
                onload="SessionDataSource1_Load">
                                <UpdateParameters>
                                    <asp:Parameter Name="pds#categoryID" Type="Int32" />
                                    <asp:Parameter Name="pds#categoryNAME" Type="String" />
                                    <asp:Parameter Name="UID" Type="Int32" />
                                </UpdateParameters>
                            </asp:SqlDataSource>--%>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue"
                AnimationDuration="250" EnableSkinTransparency="false" Transparency="25">
            </telerik:RadAjaxLoadingPanel>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="WebBlue"
                EnableSkinTransparency="false" Transparency="25">
            </telerik:RadAjaxLoadingPanel>
            <cc1:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="GridPanel"
                Radius="9">
            </cc1:RoundedCornersExtender>
            <cc1:RoundedCornersExtender ID="RoundedCornersExtender2" runat="server" TargetControlID="RadAjaxPanel1"
                Radius="9">
            </cc1:RoundedCornersExtender>
        </div>
    </div>
</div>
James
Top achievements
Rank 1
 answered on 22 Aug 2011
0 answers
69 views
I have a slider that I want to reposition on the screen.

I have wired up a button, that when clicked, expands a slider on the page.
I want the slider to be position somewhere else on the page.

I have created an empty div where I want the slider to be positioned.  How can I move the slider so it opens/closes at that div's position?
S
Top achievements
Rank 1
 asked on 22 Aug 2011
3 answers
98 views
I've got a RadGrid on a page with an Excel image above it. The onClick property of the image calls Button1_Click.

The Button1_Click code on the .cs page is:
protected void Button1_Click(object sender, System.EventArgs e)
    {
        RadGrid1.ExportSettings.FileName = "Items";
        RadGrid1.ExportSettings.ExportOnlyData = true;
        RadGrid1.ExportSettings.IgnorePaging = true;
        RadGrid1.ExportSettings.OpenInNewWindow = true;
        RadGrid1.MasterTableView.ExportToExcel();
    }

The problem is that when clicking the image, instead of a new window opening with an Excel spreadsheet or download dialog box, the current screen is just refreshed displaying the entire contents of the grid instead of the 20 records per page. I don't know why the command would not be generating the Excel file.

Thanks for your help!
Susan
Top achievements
Rank 1
 answered on 22 Aug 2011
2 answers
158 views
I can't figure out how to get the postback form not making the controls hidden on posting.
Example code:
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="uc1" TagName="UserControl1" Src="~/Controls/UserControl1.ascx" %>
<%@ Register TagPrefix="uc2" TagName="UserControl2" Src="~/Controls/UserControl2.ascx" %>
<%@ Register TagPrefix="uc3" TagName="UserControl3" Src="~/Controls/UserControl3.ascx" %>
<%@ Register TagPrefix="uc4" TagName="UserControl4" Src="~/Controls/UserControl4.ascx" %>
................
................
 
       <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                       <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
       <script type="text/javascript">
           function onTabSelecting(sender, args) {
               if (args.get_tab().get_pageViewID()) {
                   args.get_tab().set_postBack(false);
               }
           }
        </script>
        <telerik:RadTabStrip AutoPostBack="false" OnClientTabSelecting="onTabSelecting" ID="RadTabStrip1" SelectedIndex="0" runat="server"
        MultiPageID="RadMultiPage1" OnTabClick="RadTabStrip1_TabClick" Orientation="HorizontalTop" ScrollChildren="true" ScrollButtonsPosition="Middle"
        PerTabScrolling="true">     
            <Tabs>
                <telerik:RadTab runat="server" Text="Class Schedule" Value="0">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="Transfer Work" Value="1">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="CLASS/GE" Value="2">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="Academic History" Value="3">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
         <%--ID="RadTabStrip1" OnTabClick="RadTabStrip1_TabClick" SelectedIndex="0" runat="server" Orientation="HorizontalTop" Align="Right" 
            AutoPostBack="false">--%>
       <%-- <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated"
        ScrollBars="Auto">--%>
         <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
            <telerik:RadPageView ID="RadPageView1" runat="server">
                <%--<uc1:UserControl1 ID="ucUserControl1" runat="server" Visible="false"></uc1:UserControl1>--%>
                <asp:Panel ID="pn0UserControl3" runat="server"></asp:Panel>
            </telerik:RadPageView>
            <telerik:RadPageView ID="RadPageView2" runat="server">
                <%--<uc2:UserControl2 ID="ucUserControl2" runat="server" Visible="false"></uc2:UserControl2>--%>
                <asp:Panel ID="pn1UserControl2" runat="server"></asp:Panel>               
            </telerik:RadPageView>
            <telerik:RadPageView ID="RadPageView3" runat="server">
                <%--<uc3:UserControl3 ID="ucUserControl3" runat="server" Visible="false"></uc3:UserControl3>--%>
                <asp:Panel ID="pn2UserControl1" runat="server"></asp:Panel>
            </telerik:RadPageView>
            <telerik:RadPageView ID="RadPageView4" runat="server">
                <%--<uc4:UserControl4 ID="ucUserControl4" runat="server" Visible="false"></uc4:UserControl4>--%>
                <asp:Panel ID="pn3UserControl4" runat="server"></asp:Panel>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
         
        <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
        </telerik:RadAjaxLoadingPanel>
...........................................
..........................................
Control ctrl0, ctrl1, ctrl2, ctrl3;
 
    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    {
        switch (e.Tab.Index)
        {
            case 0:
                ctrl0 = Page.LoadControl("~/Controls/UserControl1.ascx");
                pn1UserControl2 = RadMultiPage1.FindControl("pn1UserControl2") as Panel;
                pn1UserControl2.Controls.Clear();
 
                pn2UserControl3 = RadMultiPage1.FindControl("pn2UserControl3") as Panel;
                pn2UserControl3.Controls.Clear();
                 
                pn3UserControl4 = RadMultiPage1.FindControl("pn3UserControl4") as Panel;
                pn3UserControl4.Controls.Clear();
                 
                pn0UserControl1 = RadMultiPage1.FindControl("pn0UserControl1") as Panel;
                pn0UserControl1.Controls.Add(ctrl0);
 
                break;
 
            case 1:
                ctrl1 = Page.LoadControl("~/Controls/UserControl2.ascx");
 
                pn0UserControl1 = RadMultiPage1.FindControl("pn0UserControl1") as Panel;
                pn0UserControl1.Controls.Clear();
 
                pn2UserControl3 = RadMultiPage1.FindControl("pn2UserControl3") as Panel;
                pn2UserControl3.Controls.Clear();
 
                pn3UserControl4 = RadMultiPage1.FindControl("pn3UserControl4") as Panel;
                pn3UserControl4.Controls.Clear();
 
                pn1UserControl2 = RadMultiPage1.FindControl("pn1UserControl2") as Panel;
                pn1UserControl2.Controls.Add(ctrl1);
 
                break;
 
            case 2:
                ctrl2 = Page.LoadControl("~/Controls/UserControl3.ascx");
 
                pn0UserControl1 = RadMultiPage1.FindControl("pn0UserControl1") as Panel;
                pn0UserControl1.Controls.Clear();
 
                pn1UserControl2 = RadMultiPage1.FindControl("pn1UserControl2") as Panel;
                pn1UserControl2.Controls.Clear();
 
                pn3UserControl4 = RadMultiPage1.FindControl("pn3UserControl4") as Panel;
                pn3UserControl4.Controls.Clear();
 
                pn2UserControl3 = RadMultiPage1.FindControl("pn2UserControl3") as Panel;
                pn2UserControl3.Controls.Add(ctrl2);
 
                break;
 
            case 3:
                ctrl3 = Page.LoadControl("~/Controls/UserControl4.ascx");
 
                pn0UserControl1 = RadMultiPage1.FindControl("pn0UserControl1") as Panel;
                pn0UserControl1.Controls.Clear();
 
                pn1UserControl2 = RadMultiPage1.FindControl("pn1UserControl2") as Panel;
                pn1UserControl2.Controls.Clear();
 
                pn2UserControl3 = RadMultiPage1.FindControl("pn2UserControl3") as Panel;
                pn2UserControl3.Controls.Clear();
 
                pn3UserControl4 = RadMultiPage1.FindControl("pn3UserControl4") as Panel;
                pn2UserControl3.Controls.Add(ctrl3);
 
                break;
        }
The controls consists of RadListView, grids etc.  I even tried the Demo
Can't seem to figure this out... The other Demo doesn't use RadTabStrip and wanted these dynamic complex controls to work.  Else I will have to split these to different pages.
Joh
Top achievements
Rank 1
 answered on 22 Aug 2011
5 answers
144 views
I have a Ajaxified Grid with an embeded upload ( coppied from the live examples) It is very much the same in that the grid has an image and a description. I am using an SQl database instead of the session db Telerik uses. The grid displays fine but when I attempt to upload a new image nothing is inserted in the database and the grid does not display any new data. This is the same for the edit mode, it does not change the data. The delete and select works fine, Any help would be greate!
Here is my code: The .ascx followed by the .ascx.cs

 

 

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      <script type="text/javascript">
          //On insert and update buttons click temporarily disables ajax to perform upload actions
          function conditionalPostback(e, sender) {
              var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
              if (sender.EventTarget.match(theRegexp)) {
                  var upload = $find(window['UploadId']);
                  //AJAX is disabled only if file is selected for upload
                  if (upload.getFileInputs()[0].value != "") {
                      sender.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
       <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" 
               ClientEvents-OnRequestStart="conditionalPostback" Width="100%" 
               EnablePageHeadUpdate="False" HorizontalAlign="NotSet">
       <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
       <telerik:RadProgressArea ID="RadProgressArea1" runat="server" Skin="Vista" />
       <telerik:RadGrid runat="server" ID="ImgGrid" AllowPaging="True" AllowSorting="True"
           AutoGenerateColumns="False" DataMember="DefaultView" ShowStatusBar="True"
           GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated"
           PageSize="4" Skin="Vista" 
               DataSourceID="objImgs">
           <PagerStyle Mode="NumericPages" AlwaysVisible="true" />
           <MasterTableView CommandItemDisplay="Top" Width="100%" DataKeyNames="ID" 
               DataSourceID="objImgs" >
               <Columns>
                   <telerik:GridEditCommandColumn ButtonType="ImageButton">
                       <HeaderStyle Width="3%" />
                   </telerik:GridEditCommandColumn>
                   <telerik:GridTemplateColumn DataField="DESCRIPTION" 
                       FilterControlAltText="Filter column column" HeaderText="Description" 
                       UniqueName="column">
                       <ItemTemplate>
                           <asp:Label ID="lblDescription" runat="server" 
                               Text='<%# TrimDescription(Eval("DESCRIPTION") as string) %>' />
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadTextBox ID="txbDescription" runat="server" Height="150px" 
                               TextMode="MultiLine" Width="370px" Text='<%# Bind("DESCRIPTION") %>'/>
                           <asp:RequiredFieldValidator ID="Requiredfieldvalidator1" runat="server" 
                               ControlToValidate="txbDescription" Display="Dynamic"
                               ErrorMessage="Please, enter a description!" SetFocusOnError="true" />
                       </EditItemTemplate>
                       <ItemStyle HorizontalAlign="Right" />
                   </telerik:GridTemplateColumn>
                   <telerik:GridBinaryImageColumn DataAlternateTextField="DESCRIPTION" 
                       DataAlternateTextFormatString="Image of {0}" DataField="IMG" HeaderText="Image" 
                       ImageAlign="NotSet" ImageHeight="100px" ImageWidth="100px" ResizeMode="Fit" 
                       UniqueName="Upload" >
                       <HeaderStyle HorizontalAlign="Center" Width="175px" />
                       <ItemStyle CssClass="binaryImage" />
                   </telerik:GridBinaryImageColumn>
                   <telerik:GridClientDeleteColumn HeaderStyle-Width="35px"  
                       ButtonType="ImageButton" CommandName="delete" 
                       FilterControlAltText="Filter delete column" UniqueName="delete" >
                       <HeaderStyle Width="2%" />
                   </telerik:GridClientDeleteColumn>
               </Columns>
               <EditFormSettings>
                   <EditColumn ButtonType="ImageButton" />
               </EditFormSettings>
           </MasterTableView>
       </telerik:RadGrid>
           <asp:SqlDataSource runat="server" ID="objImgs" ConnectionString="<%$ConnectionStrings:HCRConnectionString %>" ProviderName="System.Data.SqlClient" 
               SelectCommand="SELECT ID, IMG, DESCRIPTION FROM [IMAGES] WHERE HCR_NUM = @HCR_NUM" 
               InsertCommand="INSERT INTO IMAGES( IMG, DESCRIPTION, DATA_TYPE, HCR_NUM ) VALUES (@IMG, @DESCRIPTION, @DATA_TYPE, @HCR_NUM)" 
               UpdateCommand="UPDATE [IMAGES] SET [IMG] = @IMG, [DESCRIPTION] = @DESCRPTION WHERE [Id] = @ID" 
               DeleteCommand="DELETE FROM [IMAGES] WHERE [ID] = @ID" >                            
               <DeleteParameters>
                   <asp:Parameter Name="id" Type="Int32" />
               </DeleteParameters>
               <InsertParameters>
                   <asp:Parameter Name="DESCRIPTION" Type="String" />
                   <asp:Parameter Name="IMG" Type="Object" />     
                   <asp:ControlParameter ControlID="HCARNum" Name="HCR_NUM" Type="String"  PropertyName="Text" />
                   <asp:Parameter Name="DATA_TYPE" Type="String" DefaultValue="image/jpeg" /> 
               </InsertParameters>
               <SelectParameters>
                   <asp:ControlParameter ControlID="HCARNum" Name="HCR_NUM" PropertyName="Text" 
                       Type="String" />
               </SelectParameters>
               <UpdateParameters>
                   <asp:Parameter Name="DESCRIPTION" Type="String" />
                   <asp:Parameter Name="IMG" Type="Object" />
                   <asp:Parameter Name="ID" Type="Int32" />
               </UpdateParameters>
           </asp:SqlDataSource
   </telerik:RadAjaxPanel>
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridBinaryImageColumnEditor editor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("Upload") as GridBinaryImageColumnEditor;
                RadAjaxPanel1.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", editor.RadUploadControl.ClientID));
            }
        }
  
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridBinaryImageColumnEditor editor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("Upload") as GridBinaryImageColumnEditor;
                TableCell cell = (TableCell)editor.RadUploadControl.Parent;
                CustomValidator validator = new CustomValidator();
                validator.ErrorMessage = "Please select file to be uploaded";
                validator.ClientValidationFunction = "validateRadUpload";
                validator.Display = ValidatorDisplay.Dynamic;
                cell.Controls.Add(validator);
            }
        }
  
  
        protected string TrimDescription(string description)
        {
            if (!string.IsNullOrEmpty(description) && description.Length > 200)
            {
                return string.Concat(description.Substring(0, 200), "...");
            }
            return description;
        }

OverCoded
Top achievements
Rank 2
 answered on 22 Aug 2011
2 answers
136 views
Hi,

I'm having problem finding the correct syntax to reference a GridBoundColumn in the aspx. the following is my syntax.

this is the aspx code 

<telerik:GridBoundColumn FilterControlAltText="Filter Equipmentcolumn column"  

HeaderText="Equipment" UniqueName="Equipmentcolumn" DataField="_Equipment">  

 

</telerik:GridBoundColumn>

 


this is the c# code 

GridDataInsertItem insertedItem = (GridDataInsertItem)e.Item;

GridBoundColumn

 

 

Equipment = insertedItem.FindControl("Equipmentcolumn") as GridBoundColumn;

the error is
Error 322 Cannot convert type 'System.Web.UI.Control' to 'Telerik.Web.UI.GridBoundColumn' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion C:\Development\GHG-MCA\GHG-MCA\ChevronPortEquip.aspx.cs 300 45 GHG-MCA

thanks,
Minh Bui

 

Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Aug 2011
2 answers
96 views
I am using RadGrid of AJAX, the grid is in a user control which is add DYNAMICALLY when a button is click, my issue here is that after the user control is loaded, i can do filtering in the grid the first time, but if i filter again, I got JS error :Unable to get value of the property '_showFilterMenu': object is null or undefined. I place RadAJAXManager only in the user control, and in parent page, there is only RadScriptManager. Why does this happen? This works if I add user controls at design time, but in my case, there are several grids i need to load base on different button click and each grid contains hundreds of rows, so concerning about performance, I have to add them dynamically. Please help me out.

Thank you!

 

Shannnon
Top achievements
Rank 1
 answered on 22 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?