Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
515 views

I am looking to get the URL from the radWindow from javascript.  I would rather not have to set it via javascript but not doing this it won't be able to resize the radwindow as it returns an error.  I would like to get the NavigateURL from the radWindow

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript" src="/scripts/ValidateFileType.js"></script>
    <script src="/scripts/ModalWindow.js" type="text/javascript"></script>
    <script type="text/javascript">
 
    function openWinNavigateUrl() {
            var oWnd = $find("<%= rwApplication.ClientID%>");
        oWnd.setUrl("/Repository/Application/2_CompletedPDF.pdf");
        sizeRadWindow(oWnd, 50, 55);
        oWnd.show();
    }
 
    function sizeRadWindow(oWnd, width, height) {
        var browserWidth = $telerik.$(window).width();
 
        var browserHeight = $telerik.$(window).height();
        oWnd.setSize(Math.ceil(browserWidth * width / 100), Math.ceil(browserHeight * height / 100));
        oWnd.center();
 
    }
    </script>
</telerik:RadCodeBlock>

 

                    <telerik:RadLinkButton runat="server" Text="View Completed Application"
                        OnClientClicked="openWinNavigateUrl" AutoPostBack="false" ID="_appLink">
                    </telerik:RadLinkButton>
<telerik:RadWindow RenderMode="Lightweight" runat="server" ID="rwApplication" NavigateUrl="/Repository/Application/2_CompletedPDF.pdf"
    Modal="true" InitialBehaviors="Maximize" RestrictionZoneID="NavigateUrlZone" AutoSize="false" VisibleStatusbar="false" ShowContentDuringLoad="false"
    Behaviors="Close, Maximize" Title="Completed Application">
</telerik:RadWindow>
Vessy
Telerik team
 answered on 07 Aug 2019
1 answer
216 views

Hi all, 

 

Wondering you can help.

We have found that we have to set the width of the radtabstrip in PX to get the scrolling to work.  Can we use 100% so that it uses the full browser width and enables the scroll feature if the width of the tabs is greater than width of the page.  

When we us 100% it errors, however if we set to say 500px it doesn't resize on the different size screens.

Cheers

Joel

 

Rumen
Telerik team
 answered on 07 Aug 2019
1 answer
162 views

Hello,

I am having a hard time triggering OnClientMouseOver event on parent RadMenuItem after the slide the slide containing the RadMenuItem children had been expanded. For example, take the picture below. When I hover over each sub menu item of Guitars menu item, I should have content of .rmSlide .rmVertical:before changed. It does that onClientMouseOver, but it does not change if I hover back from the slide menu items (like ClassicalGuitars, Steel String Guitars and so on) to the Guitars menu item. Is there any way I can do this easily, some functionality provided by the framework or what do you think it is the best practice in this case ? 

 

I am looking forward to your reply. 

Thank you! :)

 

Eric R | Senior Technical Support Engineer
Telerik team
 answered on 06 Aug 2019
1 answer
120 views

  Hi,

We are using RadNumericTextBox inside user control. When this page is rendering on mobile(iOS) RadNumericTextBox is not editable(seems like read only).

Kindly help me to fix this issue as soon as possible.

Code used in user control:

<td style="text-align: center;">
                        <asp:Label SkinID="fieldLabel" ID="Label1" runat="server" Text="Salary and Wages" /></td>
                    <td style="text-align: center;">
                        <telerik:RadNumericTextBox RenderMode="Lightweight" ID="MHI_Salary_Wages_Amount" runat="server" Width="70" MaxLength="8" AllowOutOfRangeAutoCorrect="True" Value="0.00" MinValue="0.00" MaxValue="99999.99" DataType="System.Decimal" Type="Currency"
                            EnableSingleInputRendering="True" Style="text-align: right" AutoPostBack="true" ClientEvents-OnKeyPress="resetValidationState" ToolTip="Salary Wages Amount" SelectionOnFocus="SelectAll">
                            <NumberFormat AllowRounding="true" DecimalDigits="2" KeepNotRoundedValue="True" KeepTrailingZerosOnFocus="True" />
                        </telerik:RadNumericTextBox>
                    </td>

 

Thanks

Loganathan

Rumen
Telerik team
 answered on 06 Aug 2019
1 answer
149 views

Is there a way to get the Required validator in HTML5 to work with the RadAutoCompleteBox box?

I tried using JavaScript to add the required attribute to the '.._Input' control in the markup but it didn't work.

Here is my code:

      <div class="form-group">        
                   <telerik:RadAutoCompleteBox
                                                 ID="txtAddress"
                                                 Runat="server"
                                                 DataSourceID="dsAddressSearch"
                                                 DataTextField="search"
                                                 DataValueField="ID"
                                                 Filter="StartsWith"
                                                 InputType="Text"
                                                 ClientIDMode="Static"
                                                 Skin="Bootstrap" RenderMode="Auto" Width="90%" AllowCustomEntry="True"   >
                                                 <TextSettings SelectionMode="Single"   />
                                             </telerik:RadAutoCompleteBox>
                                            
            <div class="invalid-feedback">Address is required. </div>
        </div>

 

Rumen
Telerik team
 answered on 06 Aug 2019
4 answers
670 views

Hi,

I am using RadDatePicker and I want to make whole week selectable. When user click on any date then whole week row will be selected and input field will be filled with Monday's date. Also I can set default week by date.
In my page, depending on some settings (SomeSettings), I want just the week days be selected (weekends be excluded) when the user clicks on one of the week numbers. Below you can find my solution. As I am calling $(".RadAjax").hide(); currently to solve the AutoPostBack problem after calling sender.selectDate() function, I was wondering if anyone can provide a better solution:

<div id="uxSmallCalendarPanel" style="width: 220px;" runat="server">
    <Telerik:RadCalendar DayCellToolTipFormat="" EnableNavigationAnimation="true" Style="text-align: center;" AutoPostBack="true CalendarTableStyle-BorderWidth="0" Width="100%" EnableMultiSelect="true" BorderStyle="None" runat="server" ID="uxCalendar" SkinID="imcrm" CultureInfo="" >
      <ClientEvents OnRowHeaderClick="confirmRowSelection"/>
   </Telerik:RadCalendar>
 </div>

 

<Telerik:RadAjaxManagerProxy runat="server" ID="uxAjaxManager">
   <AjaxSettings>
      <Telerik:AjaxSetting AjaxControlID="uxSmallCalendarPanel">
         <UpdatedControls>
         <Telerik:AjaxUpdatedControl ControlID="uxSmallCalendarPanel" LoadingPanelID="uxSmallLoadingPanel" />
         </UpdatedControls>
      </Telerik:AjaxSetting>
   </AjaxSettings>
</Telerik:RadAjaxManagerProxy>
 
<script type="text/javascript">
function confirmRowSelection(sender, eventArgs)
{   
     eventArgs.set_cancel(true);

     var year = sender.get_focusedDate()[0];
     var weekNumber = eventArgs.get_domElement().innerHTML;
     var firstDayOfSelectedWeek = new Date(year, 0, (weekNumber - 1) * 7);

 

     for (var i = 0; i < (SomeSettings ? 5 : 7); i++)
     {     
        var selectedDate = new Date(firstDayOfSelectedWeek);
        selectedDate.setDate(selectedDate.getDate() + i);
        sender.selectDate([selectedDate.getFullYear(), selectedDate.getMonth() + 1, selectedDate.getDate()]);
     }

 

     $(".RadAjax").hide();
</script>
Mehdi
Top achievements
Rank 1
Veteran
 answered on 06 Aug 2019
4 answers
251 views

Dear Sir/Madam,

i am using telerik ajax dll version (Telerik.web.ui.dll) 2019.1.215.45 in asp.net application. i have dynamically created radgrid which has more than 70 rows, so when i am trying to export radgrid to pdf using RadClientExportManager [exporting html content to pdf]. The lengthy radgrid is not continuing to next page in pdf. the first 50 rows are printed in first page the rest of the rows are not getting printed in second page.

Peter Milchev
Telerik team
 answered on 06 Aug 2019
1 answer
171 views

Hi There,

Simple scenario, probably seen multiple times but couldn't find a solution for my case.

On my aspx page, I'm loading RadTabStrips along with RadMultiPage. Both are being defined from my DB, very basic, so far it's ok.

Within each pageView, I'm dynamically creating RadGrids, bound to OnNeedDataSource and OnItemCommand.

I tried multiple methods and the current one, generates the PageViews (embedding the grids) on the OnTabDataBound event from the RadTabStrip object.

Everything works like a charm until I click on some command from my Grids (refresh / export / sort whatever). When I click on any command, all of my page views disappear and I need to refresh the whole page to get them back.

How come my OnItemCommand handler is never called while OnNeedDataSource works fine (at least when it loads)? I tried to ajaxified the postback but it's not working any better. Anyone would have some recommendation ?

 

Cheers

 

Chris

 

Simple right ?

01.<div id="dataProcessingContent">
02.    <telerik:RadTabStrip ID="rtsTabs" runat="server" MultiPageID="rmpTables" SelectedIndex="0" DataSourceID="dsPageViews" DataTextField="Name" DataFieldID="ID" DataValueField="ID" OnTabDataBound="rtsTabs_TabDataBound">
03.    </telerik:RadTabStrip>
04.    <telerik:RadMultiPage ID="rmpTables" runat="server" SelectedIndex="0">
05.    </telerik:RadMultiPage>
06.</div>
07.<asp:SqlDataSource ID="dsPageViews" runat="server" SelectCommand="P_GetSomeData" SelectCommandType="StoredProcedure" ConnectionString="<% $ConnectionStrings:MyDB %>">
08.    <SelectParameters>
09.        <asp:SessionParameter SessionField="SID" DbType="Int32" DefaultValue="0" Name="sid" />
10.    </SelectParameters>
11.</asp:SqlDataSource>

 

My code behind:

001.protected void rtsTabs_TabDataBound(object sender, RadTabStripEventArgs e)
002.{
003.    try
004.    {
005.        var pv = new RadPageView();
006.        rmpTables.PageViews.Add(pv);
007.        var sdg = new SummaryDataGrid((int)Session["SID"], (string)Session["StudyName"], int.Parse(e.Tab.Value), e.Tab.Text);
008.        sdg.InstantiateIn(pv);
009. 
010.    }
011.    catch (Exception ex)
012.    {
013.        throw ex;
014.    }
015.}
016. 
017.private class SummaryDataGrid : ITemplate
018.{
019.    private int _sid;
020.    private string _studyName;
021.    private int _effortId;
022.    private string _effortName;
023.    private RadGrid _grid;
024. 
025.    public SummaryDataGrid()
026.    { }
027.    public SummaryDataGrid(int sid, string studyName, int effortId, string effortName)
028.    {
029.        this._sid = sid;
030.        this._effortId = effortId;
031.        this._effortName = effortName;
032.        this._studyName = studyName;
033.    }
034. 
035.    public void InstantiateIn(Control container)
036.    {
037.        _grid = new RadGrid();
038.        _grid.ID = $"dataGrid_{Guid.NewGuid()}";
039.        _grid.AllowMultiRowSelection = true;
040.        _grid.AllowSorting = true;
041.        _grid.AutoGenerateColumns = true;
042.        _grid.AllowFilteringByColumn = false;
043. 
044.        _grid.MasterTableView.TableLayout = GridTableLayout.Auto;
045.        _grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
046.        _grid.MasterTableView.CommandItemSettings.ShowExportToCsvButton = true;
047.        _grid.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
048.        _grid.MasterTableView.CommandItemSettings.ShowExportToPdfButton = true;
049.        _grid.MasterTableView.CommandItemSettings.ShowRefreshButton = true;
050.        _grid.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
051.        _grid.MasterTableView.CommandItemSettings.ShowCancelChangesButton = false;
052. 
053.        _grid.ExportSettings.HideStructureColumns = false;
054.        _grid.ExportSettings.IgnorePaging = true;
055.        _grid.ExportSettings.OpenInNewWindow = true;
056.        _grid.ExportSettings.ExportOnlyData = true;
057.        _grid.ExportSettings.FileName = $"Data Summary_{_studyName}_{_effortName}_{DateTime.Now.ToString("dd-MMM-yyyy")}";
058.        _grid.ExportSettings.SuppressColumnDataFormatStrings = true;
059.        _grid.ExportSettings.Excel.Format = GridExcelExportFormat.Biff;
060.        _grid.ExportSettings.Csv.ColumnDelimiter = GridCsvDelimiter.Semicolon;
061.        _grid.ExportSettings.Csv.EncloseDataWithQuotes = true;
062.        _grid.ExportSettings.Csv.FileExtension = "csv";
063.        _grid.ExportSettings.Pdf.Creator = "Me";
064.        _grid.ExportSettings.Pdf.Author = "Me";
065. 
066.        _grid.ClientSettings.EnableRowHoverStyle = true;
067.        _grid.ClientSettings.Scrolling.AllowScroll = true;
068.        _grid.ClientSettings.Scrolling.UseStaticHeaders = true;
069.        _grid.ClientSettings.Selecting.AllowRowSelect = true;
070.        _grid.ClientSettings.Resizing.AllowResizeToFit = true;
071.        _grid.ClientSettings.AllowColumnsReorder = true;
072.        _grid.ClientSettings.ReorderColumnsOnClient = true;
073.        _grid.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Reorder;
074.        _grid.ClientSettings.AllowColumnHide = true;
075.        _grid.ClientSettings.ClientEvents.OnDataBound = "gridDataBound";
076. 
077.        _grid.NeedDataSource += Grid_NeedDataSource;
078.        _grid.ItemCommand += Grid_ItemCommand;
079. 
080.        container.Controls.Add(_grid);
081.    }
082. 
083.    private void Grid_ItemCommand(object sender, GridCommandEventArgs e)
084.    {
085.        try
086.        {
087.            switch (e.CommandName)
088.            {
089.                case "Refresh":
090.                    break;
091.            }
092.        }
093.        catch (Exception ex)
094.        {
095.            ex.GetDetails(Assembly.GetExecutingAssembly(), MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name, _sid);
096.            throw ex;
097.        }
098.    }
099. 
100.    private void Grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
101.    {
102.        try
103.        {
104.            var sda = new SqlDataAdapter("P_GetMyOtherData", new SqlConnection(MyConnectionString);
105.            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
106.            sda.SelectCommand.Parameters.AddWithValue("@sid", _sid);
107.            sda.SelectCommand.Parameters.AddWithValue("@effortID", _effortId);
108. 
109.            sda.SelectCommand.Connection.Open();
110.            if (sda.SelectCommand.Connection.State != ConnectionState.Open)
111.                throw new Exception($"Woopsy... Something failed while trying to connect to DB");
112. 
113.            var data = new DataTable(this._effortName);
114.            try
115.            {
116.                sda.Fill(data);
117.            }
118.            finally
119.            {
120.                sda.SelectCommand.Connection.Close();
121.            }
122. 
123.            _grid.DataSource = data;
124.        }
125.        catch (Exception ex)
126.        {
127.            _grid.DataSource = null;
128.            ex.GetDetails(Assembly.GetExecutingAssembly(), MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name, _sid);
129.            throw ex;
130.        }
131.    }
132.}

 

Grid_ItemCommand is never called .... ???? 

Christophe
Top achievements
Rank 1
 answered on 05 Aug 2019
1 answer
105 views
I am not sure if this is expected or not. With the RadGrid, when I define a HeaderStyle Width for each GridBoundColumn, the grid generates a lot quicker than when I do not set a width for each column. 
Eric R | Senior Technical Support Engineer
Telerik team
 answered on 05 Aug 2019
1 answer
764 views

I am using a RadGrid as a tool for searching through a table. The table itself has 30 columns. If I bring it directly into the grid (e.g. select *), its width spans three screens, which is unacceptable to the client.

So instead of loading the entire table, I've written the grid's select statement to bring in only the 10 most useful columns for searching. I would like to capture something like an OnClick event on the server side that fires immediately after the user clicks on the grid's edit image (the pencil) or insert command link. These events would fire before there is any attempt to bring up a custom edit/insert form or the default in-place form for edits/inserts.

In that event, I plan to redirect to another page (X) to be used for inserting and updating. Within the event, I would need to know if the edit or insert command had been fired. When editing, I would need to be able to get the record id so I could get all the record's data to display in the edit form. Remember the grid only knows about the 10 columns. I would handle saving back to the DB in X and on success would redirect back to the grid page, which would refresh itself naturally. 

Is this possible? I can't find anything like OnClick events for edit and insert, and don't know where and how to determine if I'm in Edit or Insert mode, or if in Edit how to find the current record ID.

Any help would be much appreciated.

Attila Antal
Telerik team
 answered on 05 Aug 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?