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

I have a page with a popup RadWindow. In the RadWindow, users fill out a simple form and click on an OK button. The processing takes several seconds and sometimes users click on the OK button again. I am trying to find a way of disabling the OK button in javascript while the process runs, if the button is not in a RadAjaxPanel or one of the controls in a RadAjaxManager, the button does not change when it is disabled. When the button is n a RadAjaxPanel or one of the controls in a RadAjaxManager, I can't close the RadWindow.

I would think this is a pretty frequent issue. Anyone have any ideas? If you know of sample code that solves this I would really appreciate it!

Thanks

Vessy
Telerik team
 answered on 01 Nov 2021
0 answers
175 views

Hi,

I have the following snippet in my ASP.NET 

<TELERIK:RADMULTICOLUMNCOMBOBOX ID="RadMultiColumnComboBoxSearch" runat="server" Filter="startsWith" FilterFields="DrawingName, Description"
	Height="800" AllowPaging="true" EnableServerFiltering="true" MinLength="3" PageSize="60" DataTextField="DrawingName" DataValueField="DrawingID">
	<COLUMNSCOLLECTION>
		<TELERIK:MULTICOLUMNCOMBOBOXCOLUMN Field="DrawingID" Title="ID" />
		<TELERIK:MULTICOLUMNCOMBOBOXCOLUMN Field="DrawingName" Title="Name" />
		<TELERIK:MULTICOLUMNCOMBOBOXCOLUMN Field="Description" Title="Description" />
	</COLUMNSCOLLECTION>
	<WEBSERVICESETTINGS ServiceType="XML" Select-DataType="JSON" Select-Url="Default.aspx/GetDrawingsSuggestion" Select-RequestType="Post" />
</TELERIK:RADMULTICOLUMNCOMBOBOX>

[WebMethod()]
public static string GetDrawingsSuggestion(string filter)
{
	string filterText = HttpUtility.UrlDecode(filter);

	using (HEN_INTRANET_ProductionEntities dc = new HEN_INTRANET_ProductionEntities())
	{
		var q = from d in dc.tbl_ENECR_Drawings
				where (d.DrawingFlag == 1 | d.DrawingFlag == 2) && d.DrawingTypeID == 1
				select new
				{
					DrawingID = d.DrawingID,
					DrawingName = d.DrawingName,
					Description = d.Description,
				};
		var drawingsList = q.ToList();

		return Newtonsoft.Json.JsonConvert.SerializeObject(drawingsList);
	}
}

Can I use a page method service to get the data I need from the server?
Looking in Fiddler the call to the GetDrawingsSuggestion method occurs, but it returns the page contents. It does not execute the method. It just returns the rendered page.

Bart
Top achievements
Rank 1
 asked on 27 Oct 2021
1 answer
279 views

I'm launching a Radwindow that contains a RadGrid.  All that is working fine.  Data displays no problem.  The problem is when I click the Edit or the Delete commands the window goes away.  Clicking those doesn't even execute the grids ItemCommand event.  

I tried the grid  on it's own sans having it in a window and it functioned as expected.  Here's my code:

ASPX

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test.aspx.vb" Inherits="OmniCare.Test" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <ajax:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true" />

        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script language="javascript" type="text/javascript">
                function OnClientclose(sender, eventArgs) {
                    var arg = eventArgs.get_argument();
                }
            </script>
        </telerik:RadScriptBlock>

        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="rgDeposits">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgDeposits" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnDeposit">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rwDeposits" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rwDeposits">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rwDeposits" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableViewState="False">
            <Windows>
                <telerik:RadWindow runat="server" ID="rwDeposits" OnClientClose="OnClientclose" VisibleStatusbar="False" Width="750px" Height="350px" CssClass="Padding">
                    <ContentTemplate>
                        <asp:Panel runat="server" HorizontalAlign="Center" Width="98%" CssClass="PanelFrame MainPanel" BackColor="#DFECFB" Height="98%">
                            <div class="General TopRound" style="width: 100%; background-color: #dcdcdc; border-bottom: 1px solid black;">
                                <asp:Label ID="Label2" runat="server" Text="Deposit Information" CssClass="Title" Width="100%"></asp:Label>
                            </div>
                            <telerik:RadGrid ID="rgDeposits" runat="server" Width="99%" AutoGenerateColumns="False" CellPadding="1" CellSpacing="1" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="False" CssClass="Center" GridLines="Both">
                                <MasterTableView GridLines="Both" DataKeyNames="CUST_DEP_ID">
                                    <HeaderStyle Font-Bold="True" />
                                    <Columns>
                                        <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                                        <telerik:GridBoundColumn DataField="CU_DEP_DATE" HeaderText="Date"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CU_DEP_DESC" HeaderText="Description"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CU_DEP_STAT" HeaderText="Stat">
                                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CU_DEP_SIGN" HeaderText="Sign">
                                            <ItemStyle HorizontalAlign="Center" CssClass="Align-Center"></ItemStyle>
                                            <HeaderStyle HorizontalAlign="Center" CssClass="Align-Center" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CU_DEP_AMT" HeaderText="Amount" DataFormatString="{0:c}">
                                            <ItemStyle HorizontalAlign="Right" CssClass="Align-Right"></ItemStyle>                                            
                                            <HeaderStyle HorizontalAlign="Center" CssClass="Align-Center" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="USER_LOGIN" HeaderText="OPR"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="cu_dep_type_id" HeaderText="OPR" Visible="False"></telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </asp:Panel>
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>


        <div>
            <telerik:RadButton ID="btnDeposit" runat="server" Text="Deposit Detail" Width="100px" RenderMode="Lightweight" CssClass="center" 
                Font-Size="9px" CausesValidation="False" AutoPostBack="True" Height="27px">
                <Icon PrimaryIconUrl="Images/DollarSign.gif" PrimaryIconLeft="5px" PrimaryIconTop="8px"></Icon>
            </telerik:RadButton>

        </div>
    </form>
</body>
</html>

VB


Imports Telerik.Web.UI

Public Class Test
    Inherits System.Web.UI.Page

    Dim db As dcDataDataContext = Nothing

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        db = New dcDataDataContext("SAMP1")

    End Sub

    Private Sub rgDeposits_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles rgDeposits.NeedDataSource
        Dim res = From x In db.sp_Cust_Dep_SEL(1)
                  Select x

        rgDeposits.DataSource = res.ToList

    End Sub


    Private Sub rgDeposits_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles rgDeposits.ItemCommand
        Dim xxx As String = e.CommandName
    End Sub

    Private Sub btnDeposit_Click(sender As Object, e As EventArgs) Handles btnDeposit.Click
        rgDeposits.Rebind()

        Dim script As String = "function f(){$find(""" + rwDeposits.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, True)

    End Sub
End Class

Attila Antal
Telerik team
 updated answer on 25 Oct 2021
1 answer
296 views

I'm trying to select an item value from DropDownTree which impeded in a RadGrid , in the add new record in the radGrid then select the item from dropdownTree , but i can't find a way to access the radgrid cell to update its value by the  DropDownTree value , 

the scenario is get the itemCode value from DropDownTree  then search in Database to get the Item Price then put the price in the RadGrid

 Protected Sub RadDropDownTree1_EntryAdded(sender As Object, e As DropDownTreeEntryEventArgs)
        GetItemPrice(e.Entry.Value)
    End Sub
    Private Sub GetItemPrice(Item_code As Int32)
        Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(ConnString)
        Dim command As SqlCommand = New SqlCommand()
        Dim myreader As SqlDataReader
        command.CommandText = "[dbo].[FindItemPrice]"
        command.CommandType = CommandType.StoredProcedure
        conn.Open()
        command.Connection = conn
        command.Parameters.AddWithValue("ItemCode", Item_code)

        Try
            myreader = command.ExecuteReader()

            If myreader.Read() Then
                Dim ItemGrid As RadGrid = CType(Page.Master.FindControl("MainContent").FindControl("RadGrid2"), RadGrid)



                For Each item As GridDataItem In ItemGrid.MasterTableView.Items
                    Dim tx As TextBox = TryCast(item.FindControl("Price"), TextBox)
                    tx.Text = myreader("Unit_Price")
                Next

            Else

            End If

            conn.Close()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
Attila Antal
Telerik team
 answered on 22 Oct 2021
1 answer
363 views

Ok, so I am working on a project where inside a RadWizard control I am adding dynamically creating RadDropDownList controls.

RadDropDownList ddl = new RadDropDownList() { ID = string.Format("FrmDDL{0}", i) };


I then call a method to select the selected RadDropDownListItem (Now using every method I can think of to select the value) (The RadDropDownList is passed to the method as 'r')

foreach (DropDownListItem l in r.Items)
{
    if (string.Compare(value, l.Value) == 0) 
    { 
        l.Selected = true; 
        r.SelectedIndex = i; 
        r.SelectedValue = l.Value; 
        r.SelectedText = l.Text; 
    }
    i++;
}

 

Now where it gets interesting is when you look at the generated code


<div id="FrmDDL0" class="RadDropDownList" style="width:300px;" tabindex="0">
    <span class="rddlInner">
        <span class="rddlFakeInput">X4</span>
        <span class="rddlIcon"><!-- &nbsp; --></span>
    </span>
    <div class="rddlSlide" id="FrmDDL0_DropDown" style="display:none;">
        <div class="rddlPopup rddlPopup_SI">
            <ul class="rddlList">
                <li class="rddlItem">&nbsp;</li>
                <li class="rddlItem">X1</li>
                <li class="rddlItem">X2</li>
                <li class="rddlItem">X3</li>
                <li class="rddlItem  rddlItemSelected">X4</li>
            </ul>
        </div>
    </div>
<input id="FrmDDL0_ClientState" name="FrmDDL0_ClientState" type="hidden" autocomplete="off">
</div>

You can clearly see that the _ClientState control is not populated with the selected value even though the <li> item has the 'rddlItemSelected' class. For comparison this is what it looks like if I selected a value from the RadDropDownList from the UI.


<input id="FrmDDL0_ClientState" name="FrmDDL0_ClientState" type="hidden" autocomplete="off" value="{&quot;enabled&quot;:true,&quot;logEntries&quot;:[],&quot;selectedIndex&quot;:4,&quot;selectedText&quot;:&quot;X4&quot;,&quot;selectedValue&quot;:&quot;X4&quot;}">

So the question really becomes, when using the RadWizard and its back and forward buttons, how do I persist client selection on a dynamically created RadDropDownList

 

Peter Milchev
Telerik team
 answered on 22 Oct 2021
1 answer
1.2K+ views

So basically when I run my ASP.NET project I get this error, the thing is I used to get this error with Newtonsoft.Json, so what I did I went to my web.config and checked the <bindingRedirect>

<dependentAssembly>
<assemblyIdentityname="Telerik.Web.UI" publicKeyToken="" culture="neutral" />
<bindingRedirectoldVersion="0.0.0.0-2020.2.617.45" newVersion="2020.2.617.45" />
</dependentAssembly>

So after I went to references and checked if the version matched with the web config and it did

 

 

                     
Vessy
Telerik team
 answered on 22 Oct 2021
1 answer
205 views

I have a Radgrid with AllowKeyboardNavigatin="true"

When using the Keyboard arrows to move around the grid, if the arrow comes into a RadDatePicker, or even a System.DateTime datatype, the value changes by 1 month depending on if the up or down arrow was used to enter that cell.

So

1.  The cell becomes dirty just by using the up / down arrow to go past them.

2. The cell actually changes value just by using the arrow to navigate past it.

 

Is there any work around or property I can set to keep this from happening but also allow use of the keyboard arrows?

** If you hold down the ctrl key along with the arrow key this DOES NOT happen.  This could be a hard training topic for my users.

Hopefully there is another way to do this.

Thanks.

 

Roger
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 21 Oct 2021
1 answer
143 views

I have the following RadClientDataSource:

      <telerik:RadClientDataSource runat="server" ID="rdsCounty">
         <DataSource>
            <WebServiceDataSourceSettings ServiceType="GeoJSON">
               <Select Url="Arizona.json" DataType="JSON" ContentType="application/json" />
            </WebServiceDataSourceSettings>
         </DataSource>
      </telerik:RadClientDataSource>

...which is being consumed by a RadMap (along with other RadClientDataSource controls) like so:

         <telerik:RadMap runat="server" ID="rdmTest" Width="800" Height="600">
            <ClientEvents OnShapeCreated="configureShape" OnShapeClick="clickShape" OnLoad="zoomToContiguousUSA" />
            <LayersCollection>
               <telerik:MapLayer Type="Bing" Key="my key here" />
               <telerik:MapLayer Type="Shape" ClientDataSourceID="rdsState" />
               <telerik:MapLayer Type="Shape" ClientDataSourceID="rdsCounty" />
            </LayersCollection>
         </telerik:RadMap>


Is it possible to change the URL from "Arizona.json" to "Illinois.json"? I want to do this on the client, using javascript, in response to user action. I've looked at the client side API for the RadClientDataSource and I don't see how this could be done. I could also load Illinois.json manually, but I've tried something like this:

                     map.layers[2].setDataSource(JSON.parse(IllinoisFileContents));

...but that doesn't seem to work.

Is there a proper technique for this?

Vessy
Telerik team
 answered on 21 Oct 2021
1 answer
178 views

Hello,

I have an if else condition which is covered by RadCodeBlock. When I try to bind any control as an updated control in RadCodeBlock by using RadAjaxManagerProxy, it throws below error.

For example; rcbCustomer is binded to rlCustomer. But it causes error. Because rlCustomer is in RadCodeBlock.

Here is RadCodeBlock;

                <telerik:RadCodeBlock ID="rcodeCustomer" runat="server">
                    <table class="fieldset-table">
                        <% if (User.IsInRole("ADMIN"))
                            { %>
                        <tr>
                            <td>
                                <telerik:RadLabel runat="server" Text="Customer" Font-Size="Large" ForeColor="Black" />
                            </td>
                            <td>
                                <telerik:RadLabel runat="server" Text=":" ForeColor="Black" Font-Bold="false" />
                            </td>
                            <td>
                                <telerik:RadComboBox MarkFirstMatch="true" ID="rcbCustomer" EmptyMessage="Please Select Customer" runat="server" Width="100%" DataValueField="ID" DataTextField="Name" AutoPostBack="true" OnSelectedIndexChanged="rcbCustomer_SelectedIndexChanged" />
                                <asp:RequiredFieldValidator
                                    runat="server"
                                    Display="Dynamic"
                                    ControlToValidate="rcbCustomer"
                                    ErrorMessage="Customer is required!"
                                    CssClass="validator" />
                            </td>
                            <td class="center" style="width: 100px">
                                <telerik:RadButton runat="server" ID="rbCustomerReload" ToolTip="Reload Customers" Icon-PrimaryIconCssClass="rbRefresh" BackColor="White" OnClick="rbCustomerReload_Click" />
                                <telerik:RadLinkButton runat="server" ToolTip="Add New Customer" Icon-CssClass="rbAdd" BackColor="White" Target="_blank" NavigateUrl="AdminUser.aspx" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <telerik:RadLabel ID="rlCustomer" runat="server" ForeColor="#333333" Font-Bold="false" Font-Size="Medium" Visible="false" />
                            </td>
                        </tr>
                        <%} %>
                    </table>
                </telerik:RadCodeBlock>

Here is RadAjaxManagerProxy;

<telerik:AjaxSetting AjaxControlID="rcbCustomer">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rlCustomer" LoadingPanelID="RadAjaxLoadingPanel" />
                    <telerik:AjaxUpdatedControl ControlID="rcbCustomerContact" LoadingPanelID="RadAjaxLoadingPanel" />
                    <telerik:AjaxUpdatedControl ControlID="rlCustomerContact" LoadingPanelID="RadAjaxLoadingPanel" />
                    <telerik:AjaxUpdatedControl ControlID="rcbCustomerAddress" LoadingPanelID="RadAjaxLoadingPanel" />
                    <telerik:AjaxUpdatedControl ControlID="rlCustomerAddress" LoadingPanelID="RadAjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>

Error;

 

Could you please help?

Thanks,

Attila Antal
Telerik team
 answered on 21 Oct 2021
2 answers
350 views

I have a radgrid that gets it's data from a Stored Proc and a gridview.DataBind() .  It works as expected, but when I edit one cell and SAVE changes utilizing the Save Changes Command Button, all my "Editable" columns now seem to have newValues even if I did not edit them.

gvResults.DataSource = DAL.ExecuteDataset(30, "GetProductionDateTrackingInfo", parms.ToArray());
gvResults.DataBind();

 

Example one column is a RadDatePicker with a MinDate

 <EditItemTemplate>
                        <telerik:RadDatePicker RenderMode="Lightweight" ID="MB_Production_DatePicker" MinDate="1/1/1970" runat="server" DbSelectedDate='<%# Bind("MB_Production_Date") %>'> </telerik:RadDatePicker>
                    </EditItemTemplate>

The newValues hashtable has this column as changed eventhough I didn't click in it.

How do I set the grid to No changes so only when a user clicks on a cell and changes it shows up in the newValues hashtable?

 

Attila Antal
Telerik team
 answered on 21 Oct 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?