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

Hello, is there a way to limit how many checkbox buttons can be selected at one time by the client/enduser? We have a page that displays more than 10 buttons at a time (all brought in server side). The buttons are set up as Telerik RadButtons ButtonType="StandardButton" ToggleType="Checkbox". When the buttons are clicked they open up videos that get displayed at the top of the page and get put into a div. We have 5 spaces for the videos to display at the top of the page. I used CheckBox because of the selected/notselected (on/off) functionality. I want to limit the user to only selecting 5 buttons at a time. If the user has 5 buttons selected and tries to click the 6th one, a message should appear that tells them only 5 can be selected at a time. They can "turn off" unselect one of the buttons if they want to select another one. I'm having trouble figuring out how to approach this. Client side or code behind? Any help is appreciated, thanks!

  <ItemTemplate>
      <div class="itemWrapper">
        <telerik:RadButton 
        RenderMode="Lightweight" 
        runat="server" 
        OnCommand="videoClicked" 
        CommandArgument='<%# Eval("videoId") %>' 
        ButtonType="StandardButton" 
        ToggleType="CheckBox" 
        ID="RadToggleButton1" 
        AutoPostBack="true">
          <ToggleStates>
            <telerik:RadButtonToggleState SecondaryIconCssClass="rbOk" Text="Selected" Value="selectedButton"></telerik:RadButtonToggleState>
            <telerik:RadButtonToggleState Text="Not Selected" Value="notSelectedButton"></telerik:RadButtonToggleState>
          </ToggleStates>
        </telerik:RadButton>

Vessy
Telerik team
 answered on 08 Feb 2022
1 answer
246 views
Hello, I need some help with a Telerik RadButton that I have set up to work like a checkbox. It's loading the OnCommand click event each time that it's clicked. I need it to be more of a on/off switch. More details below.
ButtonType="StandardButton" 
    ToggleType="CheckBox"

Current state:

  • normal state (notSelectedButton): clickable and loads OnCommand event when clicked.
  • selected/checked state (selectedButton): clickable and loads OnCommand event when clicked.

What I need the button to do:

  • normal state (notSelectedButton): stay the same - be clickable and load OnCommand="videoClicked" event.
  • selected/checked state (selectedButton): be clickable but disable OnCommand event. I want it to go back to normal state (like an on/off switch).

My example code below shows what I have so far. I don't know if this should be done client side or code behind? Any suggestions are welcomed.

aspx code:

<ItemTemplate>
  <div class="itemWrapper">
    <telerik:RadButton 
    RenderMode="Lightweight" 
    runat="server" 
    OnCommand="videoClicked" 
    CommandArgument='<%# Eval("videoId") %>' 
    ButtonType="StandardButton" 
    ToggleType="CheckBox" 
    ID="RadToggleButton1" 
    AutoPostBack="true">
      <ToggleStates>
        <telerik:RadButtonToggleState SecondaryIconCssClass="rbOk" Text="Selected" Value="selectedButton"></telerik:RadButtonToggleState>
        <telerik:RadButtonToggleState Text="Not Selected" Value="notSelectedButton"></telerik:RadButtonToggleState>
      </ToggleStates>
    </telerik:RadButton>
  </div>
</ItemTemplate>

Vessy
Telerik team
 answered on 08 Feb 2022
1 answer
190 views

Hi, has anybody come across an issue with the RadEditor causing an entire Ajax update panel to fail on an async postback?

This only happens if the RadEditor has been generated dynamically, if I have it on a user control, it' snot a problem.  Unfortunately the large legacy code base I'm working with generates a rad editor in a server control.

And has only started happening since Safari V14, it works fine on other browsers.  

This can be created using a very simple form.

I'm currently using VB in visual studio 2019 , targeting framework 4.7

 <form id="form1" runat="server">
               <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

        <div>
                   <asp:Label ID="Label2" runat="server" Text="Outside The Panel"></asp:Label>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                    <asp:Label ID="Label1" runat="server" Text="Inside the Panel"></asp:Label>


                </ContentTemplate>
                <Triggers>

                    <asp:AsyncPostBackTrigger ControlID="Button2"/>
                </Triggers>
            </asp:UpdatePanel>

            <asp:Button ID="Button1" runat="server" Text="Sync"/>
            <asp:Button ID="Button2" runat="server" Text="ASync"/>
        </div>

    </form>

 

with a very simple code behind

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim radEditor = New Telerik.Web.UI.RadEditor

        radEditor.ID = "Editor2"
        RadEditor.Enabled = True

        PlaceHolder1.Controls.Add(RadEditor)

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Label1.Text = "Updated Label 1 (sync)"
        Label2.Text = "Updated label 2 (sync)"
    End Sub

    Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Label1.Text = "Updated Label 1 (async)"
        Label2.Text = "Updated label 2 (async)"
    End Sub                                                                           
Rumen
Telerik team
 answered on 08 Feb 2022
0 answers
123 views


    function PendingRowSelected(row) {
         var guid = $find("<%=PendingRadGrid.ClientID%>").get_masterTableView().get_selectedItems()[0].getDataKeyValue("Guid");
        var radWindow = Quest.Utilities.WindowUtil.openRADWindow("PendingEditWindow", "Portlets/ConnectData/PendingEdit.aspx?id=" +guid);                          //radWindow value as undefined
        radWindow.Restore();
        var close = document.getElementById("CloseButton" + radWindow.Id);
        close.onclick = CloseRadWindow;
    }

 

Can anyone please help to resolve?

Sachita
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 08 Feb 2022
0 answers
111 views

Attacted File : Problem1.png, Problem.png

ASP.NET Web, Radgrid

Is the grammar below correct?

            string sProductCode;
            sProductCode = gvDetail.Items[8].FindControl("D_11").ToString();

 

please help me

I keep waiting for a reply.

Attacted File : Problem1.png, Problem.png

 

anna
Top achievements
Rank 1
Bronze
Iron
 updated question on 07 Feb 2022
0 answers
211 views

<ClientSettings EnablePostBackOnRowClick = "true">
<Selecting CellSelectionMode="MultiCell" />
<ClientEvents OnCellSelected="cellSelected" />

 

function cellSelected(sender, args) {
            var selectedRow = args.get_row();
            var selectedColumn = args.get_column();
            var dataItem = args.get_gridDataItem();
            var tableView = args.get_tableView();
            var cellIndex = args.get_cellIndexHierarchical();
     
            var output = String.format("Row:" + dataItem.get_itemIndexHierarchical() + ",Col:" + selectedColumn.get_uniqueName());

           alert(output); <============= I want to delete(alert(output);
However, if I clear alert(output); , gv_ItemConmmand is not called.


            sender.get_masterTableView().fireCommand("cellSelected", output);
        }

 

  protected void gv_ItemConmmand(object source, GridCommandEventArgs e)
        {          
            if (e.CommandName == "cellSelected")
            {
                gvDetail.CurrentPageIndex = 0;
                gvDetail.Rebind();

                var clickedColumnName = e.CommandArgument.ToString();
            }
        }

 

anna
Top achievements
Rank 1
Bronze
Iron
 asked on 07 Feb 2022
1 answer
191 views

I have just downloaded and installed the demo for ASP .NET/AJAX.

When I try to run it gives me three errors (and seven warnings):

  • DemoSearch.ascx does not exist.
  • Unknown server tag qsf:DemoSearch.
  • licenses.licx - could not transform license file into Binary resource

What do I need to do to get this demo working on my PC using Visual Studio 2017?

Rumen
Telerik team
 answered on 07 Feb 2022
0 answers
102 views

hi sir,

 

           i have dynamically creted a dountchart  radhtmlchart in code behind , now i want to wrap the text. I the data length is too large then the chart go smaller example is show below, otherwise is normal.

          I need solution ASAP

         the sample code:

Dim chart As New RadHtmlChart
        chart.ID = "chart"
             chart.PlotArea.XAxis.LabelsAppearance.RotationAngle = 75

        chart.PlotArea.XAxis.DataLabelsField = _ChartSeriesFieldTitlexaxis

        chart.PlotArea.Series.Clear()
        Dim series As New DonutSeries
        series.NameField = _ChartSeriesFieldTitlexaxis
        series.DataFieldY = _ChartDataFieldTitle
        chart.PlotArea.Series.Add(series)
        chart.PlotArea.XAxis.LabelsAppearance.DataFormatString = "d"
        chart.PlotArea.XAxis.BaseUnit = DateTimeBaseUnit.Days
        chart.PlotArea.XAxis.TitleAppearance.Text = _ChartSeriesFieldTitlexaxis
        chart.PlotArea.YAxis.TitleAppearance.Text = _ChartDataFieldTitle

        chart.DataSource = firstTable
        chart.DataBind()

 

 

        
M Kumar
Top achievements
Rank 1
Iron
Veteran
 asked on 07 Feb 2022
0 answers
123 views

Hello.

I need help.

I need the coordinates of Column + Row of the selected cell in Radgrid.
Is the syntax of the source I attached correct?

please reply.

keep waiting for your reply

I want to communicate with client side and server side.


In Server Side(ASP.NET), 
<ClientSettings>
    <Selecting CellSelectionMode="MultiCell" />
    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    <ClientEvents OnCellSelected="cellSelected" />
</ClientSettings>

In JavaScript,
function cellSelected(sender, args)
{
            var selectedRow = args.get_row();
            var selectedColumn = args.get_column();
            var dataItem = args.get_gridDataItem();
            var tableView = args.get_tableView();
            var cellIndex = args.get_cellIndexHierarchical();
            var output = String.format("The selected cell is located in column with name: " + selectedColumn.get_uniqueName() + " and in row with index: " + dataItem.get_itemIndexHierarchical() + ". This cell has index " + cellIndex + " and it is part from " + tableView.get_name() + ".");

sender.get_masterTableView().fireCommand("cellSelected",    ????????????? );

}



Is the syntax of the source I attached correct?

To get the Selected Column&Row Coordinate

Client Side (aspx.cs)

protected void gv_ItemConmmand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "cellSelected")
    {
 var clickedColumnName = e.CommandArgument.ToString();

         // Label1.Text = clickedColumnName;
     }
 }

Do you have any other code from this source?

In Server Side

<ClientSettings>
    <Selecting CellSelectionMode="MultiCell" />
    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    <ClientEvents OnCellSelected="cellSelected" />
</ClientSettings>

In Client Side

protected voidRadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "CellClick")
    {
        var selectedColumn = e.Item.selectedColumn.get_uniqueName();
        var selectedRow = e.Item.get_row();
    }
}

Is the syntax of the source I attached correct?             

anna
Top achievements
Rank 1
Bronze
Iron
 asked on 05 Feb 2022
1 answer
196 views

Hello,

I have a scenario where I would like to create columns dynamically and have filters on that grid. So far, when I set the AllowFilteringByColumn to true and create the column dynamically at the OnNeedDataSource event. I receive an error when I try to filter "Expression Expected".

If I take that same column and declare it aspx page, I can filter no problem.

<telerik:RadGrid ID="rgPortfolio" runat="server" 
    AllowFilteringByColumn="true" MasterTableView-AllowPaging="true" PagerStyle-AlwaysVisible="true"
    AllowSorting="true" AllowPaging="true" AutoGenerateColumns="false" 
    OnNeedDataSource="rgPortfolio_NeedDataSource"
    OnColumnCreated="rgPortfolio_ColumnCreated">
    <MasterTableView AllowFilteringByColumn="true" DataKeyNames="Id">
        <Columns>
            <%--<telerik:GridBoundColumn UniqueName="Cusip" DataField="Cusip"></telerik:GridBoundColumn>--%>
        </Columns>
    </MasterTableView>
                
</telerik:RadGrid>


private void BuildGridColumns()
{
        
    rgPortfolio.Columns.Clear();
    var col = new GridBoundColumn();
    col.UniqueName = "cusip";
    col.HeaderText = "cusip";
    col.DataField = "cusip";
    rgPortfolio.MasterTableView.Columns.Add(col);

}

protected void rgPortfolio_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    BuildGridColumns();
    rgPortfolio.DataSource = Reporting.Investor.GetActivePortfolioItems();
}

Doncho
Telerik team
 answered on 04 Feb 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?