Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
686 views
Hi. it is my primer tuto post.
Topic: how use RadConfirm() function in a button (or another control with similar ClientEvents) without make a full postback (just it is different to use confirm javascript function).

scenario:
Asp.net framework 4, RadControls for asp.net 2011 Q2, c# development

Steps.
1.    Add this controls to you aspx file.
    RadScriptManager
    RadAjaxManager
    RadWindowManager
    RadButton
    Another controls that satisfy your needs.
2.    Set ajax manager to your fits, for example set radbutton as fire control and a image control as updated control
3.    Set onClientClicked event of your radbutton as: 'CheckItem'
4.    Set CommandName argument as 'btnShowImage' (or of you preference, this must identify unique control)
<telerik:RadButton ID="btnShowImage" runat="server" Text="Show Image"
OnClick="btnShowImage_Click" CommandName="btnShowImage"
onclientclicked="CheckItem">
</telerik:RadButton>

5.    include next javascript code in your aspx file.
function CheckItem(sender, e) {
    if (sender._commandName == "btnShowImage") {
        RadConfirm("¿are sure?", btnShowImageResume, 330, 100, null, "Confirm.");
        sender.set_autoPostBack(false);
    }
    else {
        sender.set_autoPostBack(true);
    }
}
 
function btnShowImageResume(arg) {
    if (arg) {
        __doPostBack("btnShowImage", "onclick");
    }
}

Explain: btnShowImage is a button which when pressed displays the image in an image field (or your explicit need). this button must have some postback event for this example 'onclick' event (behind code). when user clicks on the radbutton fires client side event 'CheckItem' if command name parameter match with button then function call RadConfirm method: "RadConfirm(confirm message, javascript function that be executed after user take a decision, width, height, objet reference, message tittle);"
After, javascript cancel objet postback (preventing that compiler continues with onclick event code.) else continues with postback.
When user takes a decision RadConfirm call resume function in this example:'btnShowImageResume' function, this function validate if arg parameter (result) is true then executes onclick event of the control else does not do nothing (you can execute another event if you want). when we call to _dopostback javascript function, RadAjaxManager evalues situation and execute its.

I hope they will be of great help.
Marin Bratanov
Telerik team
 answered on 11 Jun 2019
6 answers
1.4K+ views
Hi 

Is it possible for the RadDateTimePicker to display and select the hours and minutes separately?
Marin Bratanov
Telerik team
 answered on 11 Jun 2019
6 answers
898 views
I cannot see to figure out how to force a RadComboBox to requery for its list of items client-side.

One solution I tried was to surround the RadComboBox with a RadAjaxPanel (by the way when I do that the VS parser claims that RadComoBox is not a known element even though the solution compiles and runs fine.). In addition, I wired up the ItemsRequested event to populate the control. Then on the client side I call something like:
var combo = $find("<%=this.MySpiffyCombo.ClientID %>"); 
combo.requestItems(); 
 

Another solution I tried was to use RadAjaxManager (which would be my preferred choice) where the AjaxControlID on the AjaxSetting and its only AjaxUpdatedControl item's ControlID are both set to the RadComboBox. Then on the client I tried:
var ajaxManager= $find("<%=this.RadAjaxManager1.ClientID %>"); 
ajaxManager.ajaxRequest("foo"); 

Which did not fire on the server. Then I tried:
var ajaxManager = $find("<%=this.RadAjaxManager1.ClientID %>"); 
ajaxManager.ajaxRequestWithTarget("<%=this.MySpiffyCombo.UniqueID %""");  

I also tried wiring up the AjaxRequest event on the RadAjaxManager and again it did not fire.

What am I missing here? What is the Hoyle technique for ajax-ifying a RadComboBox and forcing a ajax refresh of its items?

jroughgarden
Top achievements
Rank 1
 answered on 10 Jun 2019
7 answers
815 views

I have a radhtmlchart using BarSeries with one data series.  The data is sourced from a linq query, not generated directly in codebehind like the demo for colorizing bars shows.  What I would like to do is colorize the bars depending on a second value in the results of the query.

The top of the chart code is straightforward.  I'm leaving out non-relevant code but let me know if there's something else you need to see.

            <telerik:RadHtmlChart ID="BarChart1" runat="server">
                <PlotArea>
                    <Series>
                        <telerik:BarSeries DataFieldY="DailyGrossQty" Name="Daily Gross Qty" Visible="true" Stacked="false" gap=".4" spacing="0.4">
                            <Appearance>
                                <FillStyle BackgroundColor="#145e8e"></FillStyle>
                            </Appearance>
                        </telerik:BarSeries>

 

The linq query is also straightforward:

            var x = from Z in db.spDailyData(ReportDate)
                    select Z;

           BarChart1.DataSource = x.OrderByDescending(o => o.DailyGrossQty).Take(25);

There is another field in the stored procedure called 'Division' and I would like to conditionally color the bars based on the value there, overriding the default.

What would be the simplest approach to that?

Thanks.

-Dan

 

 

Vessy
Telerik team
 answered on 10 Jun 2019
3 answers
228 views
Hey guys,

I am using LoadOnDemand throughout this app in all my RadComboBox instances... Here is an example...

 

<telerik:RadComboBox ID="rcProject" Runat="server" AllowCustomText="false"

 

 

 

AutoPostBack="True" EmptyMessage="Type a Project Name"

 

 

 

EnableLoadOnDemand="True" EnableVirtualScrolling="True" Filter="StartsWith"

 

 

 

Height="22px" MaxHeight="200px" OnItemsRequested="rcProject_ItemsRequested"

 

 

 

ShowMoreResultsBox="true"

 

 

 

ToolTip="You can type or scroll and select. What you type, must exist in the list"

 

 

 

Width="200px">

 

 

 

</telerik:RadComboBox>

 

 


My issue is that once a value is selected in this combobox, once the user clicks on the combobox to select another item... the previously selected item is the only thing showing up in the list... because of the item selected is a match...

I have tried to clear the text, value of the combobox in the rcProject_ItemsRequested event handler but not able to get it to clear... The text is still there. Could you help me with a client side workaround? I have seen some other posts but unable to implement anything, I keep getting Object is null...

Thanks much,

Sergiu Pascutiu
Dave
Top achievements
Rank 1
 answered on 07 Jun 2019
1 answer
108 views

In the Radscheduler I have the grid divided every 30 minutes. but if for example I have a 2-hour appointment, it fills the slot with a single appointment. How do I leave the 30-minute split even when entering long appointments?

 

Peter Milchev
Telerik team
 answered on 07 Jun 2019
2 answers
654 views

How can I set the border style of the row on HoverRow?

I can set the back color no problem.

But, any change to the border does not seem to have any effect.

 

In<ClientSettings> of grid I set EnableRowHoverStyle="true" 

 

Then is style section I have css:

<style type="text/css">
         div.RadGrid .rgHoveredRow
         {
           background-color:#ff0000 !important;  /* this works */
           border-width:thick !important;    /* no effect */
           border-right-color:black !important;/* no effect */
         }    
    </style>

Attila Antal
Telerik team
 answered on 07 Jun 2019
2 answers
543 views

     I have a user control with a RadGrid in my applicaiton.

 

The RadGrid fills properly by binding a datatable to the grid.  It shows properly on the screen with data.

 

Once I try to Sort or group, I am getting this error:

 

Any suggestions would be appreciated.  I am on Version 2019.2.514.40 of Telerik asp.net controls.

 

Unable to cast object of type 'ASP.masterpages_main_master' to type 'Telerik.Web.UI.GridTableView'.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.InvalidCastException: Unable to cast object of type 'ASP.masterpages_main_master' to type 'Telerik.Web.UI.GridTableView'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 

[InvalidCastException: Unable to cast object of type 'ASP.masterpages_main_master' to type 'Telerik.Web.UI.GridTableView'.] Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +3585 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9884270 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639

 

Thanks,

 

Rog

Vessy
Telerik team
 answered on 07 Jun 2019
13 answers
713 views
Hi
  I am building a web application which contains list of grids in different area's. All have export options working fine but there is one grid which Export blank CSV even there is record. I have tried every possible option  but no output. Any help would be appreciated. this is the HTML code.

 

<telerik:RadGrid ID="radGridSelectUser" runat="server" Skin="Office2007"

 

 

AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true"

 

 

AllowMultiRowSelection="true" Width="99%" >

 

 

<GroupingSettings CaseSensitive="false" />

 

 

<ExportSettings OpenInNewWindow="true">

 

 

<Pdf FontType="Link" PaperSize="A4" />

 

 

<Excel Format="Html" />

 

 

<Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" />

 

 

</ExportSettings>

 

 

<ClientSettings>

 

 

<Selecting AllowRowSelect="true" />

 

 

</ClientSettings>

 

 

 

<MasterTableView >

 

 

<PagerTemplate>

 

 

<!-- This is my custom footer-->

 

 

 

 

 

<uc1:gridFooter ID="gridFooter" runat="server" />

 

 

</PagerTemplate>

 

 

<Columns>

 

 

<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" DataField="Username" SortExpression="Username" FilterControlWidth="95%" >

 

 

<ItemTemplate>

 

 

<asp:LinkButton runat="server" ID="lnkUserName" OnClick="lnkUserName_Click" ToolTip='<%# DataBinder.Eval(Container.DataItem,"Username")%>' CommandName="SELECT" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"UserId")%>' Text='<%# DataBinder.Eval(Container.DataItem,"Username")%>'></asp:LinkButton>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 



Code Behind on Button Click

// There are mostly records between 2- 10

radGridSelectUser.ExportSettings.ExportOnlyData =

true;

 

radGridSelectUser.ExportSettings.IgnorePaging =

true;

 

radGridSelectUser.ExportSettings.OpenInNewWindow =

true;

 

radGridSelectUser.MasterTableView.ExportToCSV();


Best Regards

 

Rizwan Bashir

 

Jeff
Top achievements
Rank 1
 answered on 05 Jun 2019
13 answers
188 views

Hi,

I am getting a WebResource.axd 404 with the query string "P1cfbt_tMqMFRD7W.....asPNRfcrST-9miVNk1". When decrypted it says "pTelerik.Web.UI.Skins|Telerik.Web.UI.Skins.Windows7.Grid.sprite.png". All my other skins and sprites are loading properly. I have been through the telerik documentation discussing skins and WebResource.axd issues to no avail. 

Any help would be appreciated.

Thanks,

Mike

Allen
Top achievements
Rank 2
Iron
Veteran
 answered on 05 Jun 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?