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

I having having some issue with the filter of RadGrid. 

When i type ‘ the result is showing no data found which is what i wanted.

but if i type something like abc.get(‘abc’); or â€˜) OR 1=1 -- the filter textbox get cleared and all result is shown. Would like to check other than this, is there anyway to not clear the filter textbox and for the result to show no data found instead?

Attila Antal
Telerik team
 answered on 14 Apr 2021
8 answers
8.9K+ views
I want to obtain via Javascript the SelectedValue of a RadComboBox but it seem not possible.
My goal is to change (clientside) RadComboBox1 selectedvalue, starting from another javascript event.

Here you can find the example page:

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderBody" runat="Server">
    <script type="text/javascript">  
        function getvalue()  
        {
            var combo = <%=RadComboBox1.ClientID %>;
            alert(combo.SelectedItem);
            alert( document.getElementById(combo.UniqueID + "_value").value );
        }  
    </script>
    <telerik:RadComboBox ID="RadComboBox1" runat="server">
        <Items>
            <telerik:RadComboBoxItem Text="Item1" Value="Value1" />
            <telerik:RadComboBoxItem Text="Item2" Value="Value2" />
            <telerik:RadComboBoxItem Text="Item3" Value="Value3" />
        </Items>
    </telerik:RadComboBox>
    <input id="Button1" type="button" value="button" onclick="getvalue();" />
</asp:Content>

Anyone can help?
Peter Milchev
Telerik team
 answered on 13 Apr 2021
2 answers
220 views
I'm trying to convert a RadToolButton into one with an ItemTemplate so I can use the <Icon> element for the modern css icon classes, but when I use the RadButton instead of the original RadToolButton, the client javascript function doesn't fire. How can I re-use the same javascript function for the RadButton inside the ItemTemplate as it is used in the RadToolButton?



<script>
function rtbClientDebts_ButtonClick(sender, args)
        {
            var button;
            button = args.get_item();
            ProcessGridCommand (button.get_commandName());
        }
</script>



<telerik:RadToolBar runat="server" ID="rtbClientDebts" Skin="Metro"  Width="100%" OnClientButtonClicked="rtbClientDebts_ButtonClick" EnableViewState="false">
        <Items>
 
            <%----- OLD BUTTON -----%>
            <telerik:RadToolBarButton runat="server" Text="Add"  CommandName="AddCreditor" SearchName="AddCreditor" Enabled="True" />
 
            <%----- NEW DESIRED BUTTON -----%>
            <telerik:RadToolBarButton>
                <ItemTemplate>
                    <telerik:RadButton runat="server" Text="Add" CommandName="AddCreditor" SearchName="AddCreditor" Enabled="True">
                        <Icon PrimaryIconCssClass="rbAdd" />
                    </telerik:RadButton>
                </ItemTemplate>
            </telerik:RadToolBarButton>
 
</Items>
</telerik:RadToolBar>

Vessy
Telerik team
 answered on 13 Apr 2021
0 answers
106 views

We have a RadCloudUpload control that saves files to an S3 bucket. A postback is done afterwards by a save button. Works fine on dev machines.

On the AWS servers, some files get deleted after upload and save, but not all.
I uploaded 18 files today, 17 of them got deleted after the UncommitedFilesExpirationPeriod (which is set to 1 hour). This was during the day, when we run 16 web servers in a load balanced server group.
I tried later in the evening, when we reduce it to 2 web servers in the group. At that point, I uploaded 18 files again, and 9 were deleted.

That made me suspect that the problem is that the postback is done to a different webserver, and thus the RadUploadControl does not set the files as committed. Does that seem likely? If not, what could be the cause of this?

And more importantly, how should I solve it? I looked in the forum here and found how to override the DeleteFile method, which works... but then how do I allow users to delete files (which seems to work by simply never committing the file and then deleting it from S3 after the UncommitedFilesExpirationPeriod ).

Thanks.

Micke
Top achievements
Rank 1
 asked on 13 Apr 2021
3 answers
230 views

I found this thread but couldn't get the behavior I wanted.

I would like to debounce requests to a WebService method I attached to a RadComboBox.

I am using Lodash and Underscore.js' "debounce" function, but I find that each keypress or even focus on the RadComboBox (perhaps I should set_cancel(true) on focus).

 

My current setup is:

HTML:

1.<telerik:RadComboBox OnClientItemsRequesting="requesting" EnableLoadOnDemand="true" AllowCustomText="true" ItemRequestTimeout="0">
2.    <WebServiceSettings Path="Service.asmx" Method="GetData">
3.    </WebServiceSettings>
4.</telerik:RadComboBox>

 

JS:

01.function requesting(sender, args) {
02.    let context = args.get_context();
03.    context["FilterString"] = args.get_text();
04. 
05.    // Set a delay before requesting items
06.    let debounceTimer = 1000;
07. 
08.    // Begin debouncing
09.    _.debounce(setContext, debounceTimer);
10.}
11. 
12.function setContext(sender, args) {
13.    var context = args.get_context();
14.    if (!sender.prefix)
15.        sender.prefix = "";
16.    if (!window.event || sender.directcall) {
17.        sender.prefix = args.get_text();
18.    }
19.    var id = sender.get_id();
20.    // Limit minimum character length to 3
21.    if (sender.prefix.length < 3) {
22.        // Ensure clear is only called when backspacing to an empty value
23.        if (window.event && window.event.type != "click") {
24.            clearText(); // Clear results if nothing is typed in
25.        }
26.        args.set_cancel(true); // cancel server call if nothing typed in
27.        return false;
28.    }
29.    context["prefix"] = sender.prefix;
30.    return true;
31.}

 

Is there something I am missing/incorrect in my setup?

 

The pseudocode I am thinking goes along the lines of:

1. Type at least 3 or more characters in the combo box input

2. Wait 1000ms

3. If another key is entered within 1000ms, reset debounce timer

4. Else proceed call to WebService method

5. Combo box populated

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Matthew
Top achievements
Rank 1
Veteran
 answered on 13 Apr 2021
3 answers
2.1K+ views
I used javascript debugger and did find an object to get the "checked" items in my RadComboBox.
what is the proper way to do this so I can clean up my code?
in my case I am getting the list of categories to send to RadScheduler provider

    window.OnClientAppointmentsPopulating = function (sender, eventArgs) {
        var combobox = $find("<%=ddlCatToShow.clientID %>");
        var list = "";
        var items = combobox.get_items();
        var array = combobox._checkedIndices.toString().split(','
        for (var i = 0; i < array.length-1; i++) { 
      
            var item = items.getItem(array[i]);
        //alert(item.get_text()); 
        //alert(item.get_value());   
            list += item.get_value() + ",";
        
        eventArgs.get_schedulerInfo().CategoryList = list.replace(/,\s*$/, "");
};


Vessy
Telerik team
 answered on 12 Apr 2021
4 answers
409 views
Hi,
I have a project where in a RadGrid the Master Table rows contain template columns that display totals based values in the Child detail table. The user is able to Update the Detail table rows which would affect the totals given in the parent row. However, when the user does update a record, the parent row doesn't update until I reload the page. How can I use the update event to also rebind the parent row?

I currently have a SQLDataSource object for each of the Parent and Child tables. Is there a relatively easy way to get the Parent Row to rebind on update since I shouldn't need to rebind all rows in the parent?

Currently, I have only written a RadGrid1_UpdateCommand and RadGrid1_ItemDataBound.

protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    //Get the GridEditableItem of the RadGrid      
    GridEditableItem editedItem = e.Item as GridEditableItem; 
 
    //Get the Primary Key associated with the edited row 
 
    //Get the Control Values for the associated rows 
 
    //Insert and update soem information in the database             
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridDataItem && e.Item.OwnerTableView.DataSourceID == "SQLDataSourceParent"
    { 
         //Get the GridEditableItem of the RadGrid      
        GridDataItem dataItem = e.Item as GridDataItem; 
                 
        //Get the primary key value of the row using the DataKeyValue.      
                 
        //Set the Template Column values based on database records 
    } 

Attila Antal
Telerik team
 answered on 12 Apr 2021
3 answers
115 views

I have a product in asp.net web forms which has 6000+ plus clients with differant databases.

I stored raddock state of user controls in database. now i want to convert my application to mvc. so now how could i load this state in mvc . user controls treated as partial view

Vessy
Telerik team
 answered on 12 Apr 2021
1 answer
334 views

     So here is the button code

<div class="row mb-3">
        <div class="col-lg-6">
           <div class="form-inline">
                <telerik:RadButton ID="btnRunAudits" runat="server" SingleClick="true" OnClick="btnRunAudits_Click" CssClass="btn btn-info mr-3">
                    <ContentTemplate>
                        <i class="fal fa-long-arrow-right"></i>Execute System Edits
                    </ContentTemplate>
                </telerik:RadButton>     
                <telerik:RadLabel ID="lblExecuteAuditHistory" runat="server" CssClass="time-stamp" Visible="false"></telerik:RadLabel>
           </div>
        </div>
        <div class="col-lg-6 text-right">
            <telerik:RadButton ID="btnExport" runat="server" OnClientClicking="btnExport_onClientClicking" OnClick="btnExport_Click" CssClass="btn btn-info">
                <ContentTemplate>
                    <i class="fal fa-file-export"></i>Export Option(s)
                </ContentTemplate>
            </telerik:RadButton>
            <telerik:RadButton ID="btnRefreshErrors" runat="server" OnClick="btnRefreshErrors_Click" CssClass="btn btn-refresh" SingleClick="true" Width="100">
                <ContentTemplate>
                    <i class="far fa-sync"></i> Refresh
                </ContentTemplate>
            </telerik:RadButton>
        </div>
    </div>

Here is what normally works but does not:

protected void btnRunAudits_Click(object sender, EventArgs e)
        {
            // CLF - the button should be disabled if you can't click.  But just in case!
            if (util.Db.GetUBUserAssign(ubid) == util.appUserId && IsValidEdit(util.Db.GetUBStatusByUBID(ubid).ToString()))
            {
                btnExport.Enabled = false;  <==========
                btnRefreshErrors.Enabled = false; <=========

                //util.Db.RunUBAuditsBC(ubid);
                BuildExceptionGrid();
                if (gItemizedParsing.Items.Count > 0)
                {
                    plcTraining.Visible = true;
                }
                else
                {
                    Session["UBAuditOpen" + ubid.ToString()] = "T";
                    Response.Redirect("~/ubEditor.aspx?SysID=" + ubid.ToString(), false);
                }
                //add entry into audit history table
                util.Db.SaveLastExecuteInfo(ubid, util.appUserId);
                lbItemsRemaining.Text = util.Db.GetPotentialItemsRemaining(ubid);
                DataTable dt = util.Db.GetLastExecuteInfo(ubid);
                if (dt.Rows.Count > 0)
                {                 
                    lblExecuteAuditHistory.Visible = true;
                    lblExecuteAuditHistory.Text = "Last Executed by " + dt.Rows[0]["displayNm"].ToString() + " at " + dt.Rows[0]["dateup"].ToString();
                }

                btnExport.Visible = true;
                btnRefreshErrors.Visible = true;
            }
            else
            {
                btnRunAudits.Enabled = false;
            }            
        }

I have verified it is hitting the code above noted with <========

Basically when they press the btnRunAudits button i want btnExport and btnRefreshErrors disabled until btnRunAudits is done.

HELP :)

Vessy
Telerik team
 answered on 09 Apr 2021
3 answers
1.0K+ views

I have a RadGrid that I want to show a Font Awesome icon as a button. The column is set as a GridButtonColumn ButtonType="FontIconButton" with the button css class set. When the CommandName is blank the icon shows. When I assign the value CommandName="GetvCard" the grid shows the text "GetvCard" and not the icon. I don't have any code attached to the button yet as I was testing the UI only. Full grid markup:

 <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" DataSourceID="ObjectDataSource1" AllowFilteringByColumn="true" EnableLinqExpressions="false">
<MasterTableView AutoGenerateColumns="False" DataSourceID="ObjectDataSource1">
<Columns>
<telerik:GridButtonColumn ButtonType="FontIconButton" ButtonCssClass="fad fa-address-card xgrid blue" CommandName="GetvCard" UniqueName="GetvCard" CommandArgument="GetvCard">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="MYNAME" FilterControlAltText="Filter MYNAME column" HeaderText="Name" ReadOnly="True" SortExpression="MYNAME" UniqueName="MYNAME">
<FilterTemplate>
<telerik:RadTextBox ID="RadTextBox1" runat="server" ClientEvents-OnBlur="NameSearch" EmptyMessage="Name Search"></telerik:RadTextBox>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function NameSearch(sender, args) {
var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");

var mystring = sender.get_value();
tableView.filter("MYNAME", mystring, "Contains");
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DSCRIPTN" AllowFiltering="false" FilterControlAltText="Filter DSCRIPTN column" HeaderText="Title" SortExpression="DSCRIPTN" UniqueName="DSCRIPTN">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EXTENSION" AllowFiltering="false" FilterControlAltText="Filter EXTENSION column" HeaderText="Extension" ReadOnly="True" SortExpression="EXTENSION" UniqueName="EXTENSION">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CELLNO" AllowFiltering="false" FilterControlAltText="Filter CELLNO column" HeaderText="Mobile No." ReadOnly="True" SortExpression="CELLNO" UniqueName="CELLNO">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="INET1" AllowFiltering="false" FilterControlAltText="Filter INET1 column" HeaderText="Email" SortExpression="INET1" UniqueName="INET1">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>

Am I missing something?

Scott


Doncho
Telerik team
 answered on 08 Apr 2021
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?