Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
86 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
121 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
202 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
173 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
162 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
116 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
1 answer
230 views
I need help for the following scenario.

1. In inline edit mode if I double click  a row It has to changed to edit mode.
2. Once again if I doucle click the edited row Or if I select the another row for edit,  it should call the Update and the changes made in the row to be reflected in the datatable.

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx


Elliott
Top achievements
Rank 2
 answered on 22 Aug 2011
2 answers
76 views
  Hello, I have enabled grouping on my programatically (dynamic) created RadGrid.  I am persisting the group expressions through cookies and all it working well.  By default, all the groups are expanded.  When I collapse a set of rows they collapse just fine.  However, when I try to expand those same rows nothing happens.  The page appears to be doing a post-back, but not change is made on the screen.  No error, no message at all. 
  I'm guessing that the code is executing a toggle operation and believes (due to it's dynamic nature) that I clicked on an expanded node that needs to be collapsed.  And thus it is doing exactly what it is supposed to.  Is there a way to have the expand/collapse done on the client side so that a post-back does not have to occur?  Or does the fact that the item collapsed needs to be persisted in some manner.  Any direction in either path would be appreciated.

Alex
Top achievements
Rank 1
 answered on 22 Aug 2011
1 answer
164 views
Hello,

We have a slider bound to the RadSlider similar to the demo on http://demos.telerik.com/aspnet-ajax/slider/examples/rangeslider/defaultcs.aspx. sorry project is  on or dev platform which is not accessible.

the difference is at each step in the slider we are passing in content to populate the tool tip that will lead the user to a different page. The issue we have is if the user clicks on ether the rsTrack or the increase/descrease handles, the tool tip appears in different heights at different steps.

How can we keep it so the tool tip is always bound to the rshandle.

here is the code we are using

<telerik:RadToolTip EnableShadow="false" BorderStyle="Solid" BorderWidth="10" OffsetY="5"
            HideDelay="1" ID="RadToolTip1" runat="server" RelativeTo="Element" Position="TopCenter"
            ShowCallout="true" Width="425px" ShowEvent="fromcode" HideEvent="FromCode"
            EnableEmbeddedSkins="false" Skin="SLIDER">
        </telerik:RadToolTip>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
                function OnClientLoad() {
                    ShowRadToolTip(tooltip, sender);
                }
                function OnClientValueChange(sender, args) {
                    if (!isSliding) return;
                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
                    ResetToolTipLocation(tooltip);
                    tooltip.set_text(GetItemValue());
                }

                function OnClientValueChanged(sender, args) {
                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
                    ShowRadToolTip(tooltip, sender);
                    tooltip.set_text(GetItemValue());
                }

                var isSliding = false;
                function OnClientSlideStart(sender, args) {
                    isSliding = true;

                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
                    ShowRadToolTip(tooltip, sender);
                }

                function OnClientSlideEnd(sender, args) {
                    isSliding = false;
                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
                    ShowRadToolTip(tooltip, sender);
                }

                function ShowRadToolTip(tooltip, slider) {
                    var activeHandle = slider.get_activeHandle();
                    if (!activeHandle) return;
                    tooltip.set_targetControl(activeHandle);
                    ResetToolTipLocation(tooltip);
                }

                function ResetToolTipLocation(tooltip) {
                    if (!tooltip.isVisible())
                        tooltip.show();
                    else
                        tooltip.updateLocation();
                }
                function GetItemValue() {
                    return $find('<%= InvestmentsSlider.ClientID %>').get_items()[$find('<%= InvestmentsSlider.ClientID %>').get_value()].get_value();
                }
            </script>
        </telerik:RadCodeBlock>
        <telerik:RadSlider runat="server" ID="InvestmentsSlider" Height="200px"
            style="margin: auto;" IsSelectionRangeEnabled="false" OnClientSlide="OnClientValueChange" OnClientLoad="OnClientValueChanged"
            OnClientValueChanged="OnClientValueChanged" OnClientSlideStart="OnClientSlideStart"
            OnClientSlideEnd="OnClientSlideEnd" ShowDecreaseHandle="true" ShowIncreaseHandle="true"
            ItemType="Item" />
Slav
Telerik team
 answered on 22 Aug 2011
1 answer
305 views
Forget it. The template I was working from was done by another programmer who I don't have contact with ... or trust.
Tonyz289
Top achievements
Rank 1
 answered on 22 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
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?