How to reset telerik dropdownlist control value on client side - telerik

I want to reset dropdownlist selection on clear button click and set default message.
<telerik:RadDropDownList ID="radDrpDwn_User" runat="server" Width="325px" DefaultMessage="--select--">
</telerik:RadDropDownList>

First of all there isn't any control in telerik called (RadDropDownList) , the compatible control is RadComboBox control
so you define it using the Following ;
<telerik:RadComboBox ID="radDrpDwn_User" runat="server" Width="325px" DefaultMessage="--select--">
</telerik:RadComboBox>
and in the clear Button :
protected void Clear_Click(object sender,EventArgs e)
{
radDrpDwn_User.ClearSelection();
}
regards

Related

RadComboBox with Checkbox enabled - Persists last selected item text

I have developed a user control which has only a RadComboBox with checkbox enabled in it. The problem that I am facing in my pages is, whenever I deselect all the checkbox items with in the RadComboBox and on close of it, the last selected item is displayed in its text section. I am not finding a way to fix it.
In the ideal scenario, if nothing / everything is selected, I am defaulting to the text "All". If any item is selected, the item text is displayed. Can some one help me, if I have to do any specific check to fix this problem?
I am sharing a animated GIF for my issue below.
Thanks,
Sriram
I also got the same issue. But I solved as following.
Creative a property in your userControl as:
public string OnClientItemChecked {
set { ddlControID.OnClientItemChecked = value; }
}
on aspx:
<uc1:TagName ID="ddlControlID" runat="server" OnClientItemChecked="ClearValue" />
on script tag:
function ClearValue(sender, eventArgs) {
var combobox = sender;
var value = combobox._checkedIndices.toString();
if (value == "") {
combobox.clearSelection();
combobox.set_emptyMessage(combobox.get_emptyMessage());
}
}
on aspx:
Do AllowCustomText="True" in your RadComboBox.

VoiceOver does not read checkbox in a wizard in Eclipse

I have wizard and inside the wizard i have a checkbox and a text associated with the checkbox . While testing for accessibility i found that the VoiceOver does not read the text associated with the checkbox , it is read as "(un)checked checkbox". Have i missed something while adding the definition for the checkbox ?
Assuming these are SWT controls you can add an accessibility listener to set the text to be read:
control.getAccessible().addAccessibleListener(new AccessibleAdapter()
{
#Override
public void getName(final AccessibleEvent event)
{
event.result = "text for the control";
}
});
More on Eclipse Accessibility here

JuiceUI Slider - ValueChanged event not firing

I'm trying to include a JuiceUI Slider control inside a ASP.NET GridView control where each row will have a unique slider control. As a test I created a Slider control:
<juice:slider ID="MasterThresholdSlider" Value="50" Min="0" Max="100" runat="server"
Step="25" ValueChanged="MasterThresholdSlider_ValueChanged"></juice:slider>
<asp:TextBox ID="MasterThresholdText" runat="server"></asp:TextBox>
Now from the documentation I have read, I can detect the value being changed when the ValueChanged event is raised. So in the code behind I have created the following:
protected void MasterThresholdSlider_ValueChanged(object sender, EventArgs e)
{
Juice.Slider slider = (Juice.Slider)sender;
MasterThresholdText.Text = slider.Value.ToString();
}
For some reason the event doesn't fire when I run the application (breakpoint is at the beginning of the event). Anyone know what I'm doing wrong?
You'll need to add AutoPostBack="true" to the juice:slider control to initiate an autopostback. Otherwise that event won't fire until something else on the page triggers a postback.

Telerik RadAlert back button cache problem

I'm sure you have had this one before so if you could point me to something similar....
I have a server side creation of a RadAlert window using the usual Sys.Application.remove_load and add_load procedure however the alert keeps popping up as it seems to be caching when the user hits the back button after it has been activated. I have tried to put a onclick event on a button to clear the function using remove_load before it moves to the next page however it still doesn't seem to clear it.
Its used in validation so if a user inputs failed validation it pops up. If they then go and enter correct validation it then moves onto the next page. If they then use back button this is where it pops up again. Any ideas?
Server side:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
btnSearch.Attributes.Add("onclick", "Sys.Application.remove_load(f);");
}
}
private void btnSearch_Click(object sender, System.EventArgs e)
{
string radalertscript = "(function(){var f = function(){radalert('Welcome to RadWindow Prometheus!', 330, 210); Sys.Application.remove_load(f);};Sys.Application.add_load(f);})()";
RadAjaxManager1.ResponseScripts.Add(radalertscript);
}
Ive also tried using
RadAjaxManager1.ResponseScripts.Clear();
before it moves on to the next page on the postback event
What lingvomir says is correct. What I would suggest as a solution is to ajaxify that Search Button.
e.g.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Button1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>
<asp:Button ID="Button1" runat="server" Text="show radalert" OnClick="Button1_Click" /><br />
and in codebehind:
protected void Button1_Click(object sender, EventArgs e)
{
string radalertscript = "radalert('Welcome to RadWindow Prometheus!',330,210);";
RadAjaxManager1.ResponseScripts.Add(radalertscript);
}
I don't think the problem is with the radalert() function - You will get the same behavior if you use the normal browser alert() as well. The Sys.Application.Load event is raised each time the page is loaded in the browser - including when you use the back button to open it again. If the code that adds the radalert() is also on the page, it will run as well and the alert will be displayed during Load.
You need an intermediate page that loads the client version of the
alert, the callback function could then navigate to the correct page
using location.replace(...) - using location.replace will remove this intermediate alerting page from history
hope that helps

Problem with ajax modal popup extender

I have a Button which is having modalpopupextender which is working absolutely fine no problem at all, but before the modalpopup appears i want to validated text box control if it is not valid then modalpopup should not appear other wise it should work as usual..
does anybody having idea.
We use following function. On the button click you can call this function. This will validate validation group that is passed to this function and it is work will pop the modal popup otherwise validation error will appear.
function ClientSideValidate(modalId,group)
{
var modal = $find(modalId);
Page_ClientValidate(group);
if(!Page_IsValid)
{
modal.show();
}
}
Something I've done in the past is manually show/hide the modal popup. I realize the ModalPopupExtender control requires a target, so you'll need a dummy target which will remain inactive:
<asp:LinkButton id="btnDummyTarget" runat="server" />
<asp:Button
id="btnActualButtonTiedToValidation"
ValidationGroup="SomeValidationGroup"
OnClick="MyButton_Click"
runat="server" />
<ajaxToolkit:ModalPopupExtender
id="mpeMyPopup"
PopupControlID="pnlSomePanelToShow"
TargetControlID="btnDummyTarget"
runat="server" />
Then, in your codebehind you can do the following:
protected void MyButton_Click(object sender, EventArgs e)
{
if(Page.IsValid)
mpeMyPopupExtender.Show();
}
This is also handy for delete confirmation dialogs.

Resources