Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
31 views

My ASP.NET Web Form has a RadTabStrip with 3 different tabs. The first tab has the username and password, the second tab has the permissions, and the third tab has the clients. The username and password have RequiredFieldValidators on them.

I have noticed that whenever I go from one tab to another, the Windows TextBox Control txtPassword's Text field is getting reset, causing the page to not validate whenever tabs 2 or 3 are shown.

I created a hack to fix this:

Protected Sub RadTabStrip1_ClientTabSelecting(sender As Object, e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick
    Page.Validate()
    If Me.IsValid() Then
        If Not String.IsNullOrWhiteSpace(txtPassword.Text) Then
            ViewState("password") = txtPassword.Text
        End If
    Else
        If String.IsNullOrWhiteSpace(txtPassword.Text) Then
            txtPassword.Text = ViewState("password")
        End If
        If String.IsNullOrWhiteSpace(txtConfirmPassword.Text) Then
            txtConfirmPassword.Text = ViewState("password")
        End If
        Page.Validate()
        If Not IsValid() Then
            MultiView1.ActiveViewIndex = 1
            RadTabStrip1.SelectedIndex = 0
            RadMultiPage1.SelectedIndex = 0
        End If
    End If
End Sub

I do not like storing their password in the ViewState, but it works.

Almost.

The Submit button is on the bottom of the page, contained within a RadToolBar.

Protected Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
    Dim rb As Telerik.Web.UI.RadToolBarButton = e.Item
    Dim clientList As List(Of Client) = ViewState("MyClientList")
    If rb.CommandName = "Save" Then

There is a breakpoint on that line of code, but Validation fails before that code is reached.

By this point, my customers are on Tab 3, and they have no way to tell that the txtPassword control has had their input deleted on Tab 1.

Has anyone ever experienced a Windows Control like this password getting cleared whenever the RadTabStrip Index changes?

How do I fix this?

Rumen
Telerik team
 answered on 23 Jan 2025
1 answer
152 views

Hi,

How to Get the file path of the file which is uploaded via RadChat ToolBar in ClientSide. I tried with this code and it gives me the only file name.

 

 <telerik:RadChat runat="server" ID="RadChat1" Skin="Default" RenderMode="Lightweight">
            <ClientEvents OnToolClick="OnToolClick"  OnLoad="onLoad"/>
            <ToolbarSettings Toggleable="true" Animation="true">
                <AnimationSettings>
                    <ExpandSettings Duration="500" Effects="expandVertical fadeIn" />
                    <CollapseSettings Duration="500" Effects="expandVertical fadeIn" />
                </AnimationSettings>
                <ButtonsCollection>
                    <telerik:ChatToolbarButton Name="UploadImage" IconClass="t-icon t-i-image" />
                </ButtonsCollection>
            </ToolbarSettings>
        </telerik:RadChat>
        <telerik:RadAsyncUpload runat="server" DropZones=".RadChat" AllowedFileExtensions=".bmp,.jpg,.jpeg,.png,.gif" CssClass="chat-upload" ID="RadAsyncUpload1" OnClientFileSelected="OnFileSelected">
        </telerik:RadAsyncUpload>

 

Reference

https://demos.telerik.com/aspnet-ajax/chat/toolbar/defaultcs.aspx

Vessy
Telerik team
 answered on 08 Sep 2021
1 answer
140 views

I have two pages:

a.aspx
b.ascx

The goal is to get the RadToolBarButtons on b.ascx to fire the OnButtonClick() event as defined in the RadToolBar .

a.aspx is the host page for b.ascx and has this placeholder for different RadGrids:

<div id="divMiniGrid" runat="server" visible='<%# ActiveViewID != "viewFees" %>' class="rightPane">
         <sf:PaymentDetailsGrid ID="ctlMiniGrid" runat="server" class="rightPane" Visible="false" IsCondensed="true" />
</div>


b.ascx has the actual RadGrid that is loaded in a.aspx. The RadGrid has an ItemTemplated RadToolbar:

 <telerik:RadGrid ...>
    <MasterTableView ...>
        <CommandItemTemplate>
            <telerik:RadToolBar ... OnButtonClick="PaymentDetailsToolbar_ButtonClick" EnableViewState="true"  onClientButtonClicking="ClientButtonClicking" ...>
                <Items>
                    <telerik:RadToolBarButton runat="server" Text="Edit" ImageUrl="../images/icons/refresh.svg" CommandName="Edit" Enabled="False" />



The PaymentDetailsToolbar_ButtonClick() event lives on b.ascx, but it is never fired when the RadToolBarButton is clicked. Here's the signature:

protected void PaymentDetailsToolbar_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e){...}

The only event that is fired is a.aspx Page_Load() event when the RadToolBarButton is clicked. What's going on?

Attila Antal
Telerik team
 answered on 04 May 2021
2 answers
132 views
Hello, I found some strange behaviour of RadTolBar buttons when disabled by the disable() method. The button is greyed out but still responds to clicking with focus highlight, which will stay until the control is reloaded. You can test it even on the ToolBar demo at https://demos.telerik.com/aspnet-ajax/toolbar/examples/overview/defaultcs.aspx. Just disable a button from the developer console, for example the "Send" one with $find("ctl00_ContentPlaceholder1_RadToolBar1").findItemByText("Send").disable() and then try to click it. Is this behaviour expected or is it a bug? Our customers get confused by it.
Rumen
Telerik team
 answered on 21 Apr 2021
4 answers
317 views

I would prefer to use an SVG for the ImageUrl property of the RadToolBarButton. However, I cannot figure out how to get the RadToolBar to resize the image to match the button/text size.

When I export my SVG to 18px, it is deformed.  But at a larger size, it exports fine.  So, essentially I want to use that larger size, then resize it in the browser (RadToolBarButton).

How do I get the RadToolBar to resize the Image set in the ImageUrl property?

Peter Milchev
Telerik team
 answered on 03 Mar 2021
23 answers
857 views
The following code does not work when the toolbar contains any RadToolBarDropDown objects:

RadToolBar1.Items.FindItemByValue("buttonValue").Visible = true;

It results in the following exception:

Value property is not supported by RadToolBarDropDown
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.Exception: Value property is not supported by RadToolBarDropDown

This makes using it very difficult (indeed impossible).

I note that this has come up before but it seems like the problem is being ignored

 

Peter Milchev
Telerik team
 answered on 07 Dec 2020
1 answer
106 views
Hi ,
     I used three RadToolBarButton with image only in RadToolBar control , how to align all are in center position with Separator.
Screenshot -- http://prntscr.com/tchs0y
Like this -- http://prntscr.com/tchsun

Thanks
M Kumar
Top achievements
Rank 1
Iron
Veteran
 answered on 07 Jul 2020
3 answers
135 views

Hi,

 

For years I used the following code:

 

            Dim dropDown As RadToolBarDropDown = New RadToolBarDropDown("PageSize")
            dropDown.CssClass = "perPageDropDown"
            dropDown.EnableImageSprite = False
            dropDown.Text = GetGlobalResourceObject("Insight", "Per pagina")
            dropDown.ToolTip = GetGlobalResourceObject("Insight", "Per pagina")
            RadFileExplorer1.ToolBar.Items.Add(dropDown)

 

But after upgrading to R1 2020 i get the error:

 

Bericht: Value property is not supported by RadToolBarDropDown

Stack Trace:
at Telerik.Web.UI.RadToolBarDropDown.get_Value() at Telerik.Web.UI.RadFileExplorer.ConfigureToolbarButtons() at Telerik.Web.UI.RadFileExplorer.ControlPreRender() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

Any clues?

Marc

Peter Milchev
Telerik team
 answered on 22 May 2020
3 answers
199 views

Hi!

I am looking for a way to add custom attributes to RadToolbarButton to be rendered in html

When I use following snippet

RadToolBarButton button = new RadToolBarButton();
button.Attributes["data-attr"] = "CustomText";
button.CssClass += "tipsylink";


I expect to see
<a class="tipsylnk ..." data-attr="CustomText"...>

But unfortunately I can see only
<a class="tipsylnk rtbWrap"...>
without data-attr attribute.
I do use jquery to read such attributes from web controls for my custom needs.
And that works for all standard asp.net controls but unfortunately
radtoolbar implementation is different - as I understand it stores
custom attributes in another place.

I know that it is possible to read such attributes on client side using
var toolBar = $find("<%=RadToolBar1.ClientID %>");
var button = toolBar.findItemByText("Button 1");
alert(button.get_attributes().getAttribute("DisplayName"));

but actually I'd like to use standard jquery $('.tipsylnk'). selector
and process all items in the same way.
So is it possible to render custom attributes to html element attribute
for RadToolbarButtons?
Peter Milchev
Telerik team
 answered on 21 Oct 2019
4 answers
250 views
I have a Telerik AJAX Radtoolbar act against a RadGrid. I have code behind to do something when I click items on the ToolBar base on row selected in the grid, but before the post back, I need some client side validation, post back won't happen if validation fails. I tried to use
<telerik:RadToolBar runat="server" Width="100%" ID="RadToolBar1" EnableRoundedCorners="true"  OnClientButtonClicked="javascript:if(!PageValidation()){return false;}"  OnButtonClick="RadToolBar1_ButtonClick" EnableShadows="true" Skin="Office2007" Height="27px" AutoPostBack="false">
                      <Items>
                       <telerik:RadToolBarButton Text="Export" Value="1" PostBack="true" />
                        <telerik:RadToolBarButton IsSeparator="true" />
function PageValidation() {
                var IsValid = false;
                      var error = document.getElementById("errorMsg");
                var mastertableView = $find("<%= RadGrid1.MasterTableView.ClientID %>");
                 var count = mastertableView.get_selectedItems().length;
                    if (count < 1) {
                                 error.style.display = "inherit";
                        IsValid = false;
                    }
                    else {
                         error.style.display = "none";
                        IsValid = true;
                    }
                 
                return IsValid;
 
            }
However, this causes the RadToolBar unclickable and even jam all other AJAX functions on the page. if I changed the OnClientClicked to "OnClientButtonClicked="PageValidation" ", the client side validation works with the error msg pop up but it cannot stop the post back.

Are there any other ways that I can work around or did I miss something using this method?

Thanks!
Peter Milchev
Telerik team
 answered on 21 Aug 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?