Javascript - User Control With A Client Side API

Feb 28, 2011

Maybe I've picked a totally inappropriate/bad example. What I have is a user control that contains a bunch of dynamically created Telerik RadGrids. My user control is added to a couple of Telerik RadPageViews that are part of a RadMultiPage that is used alongside a RadTabStrip. What I need to do is call a Javascript function in my usercontrol to update it's display whenever it's parent RadPageView is selected.
So basically I have the following Javascript code:

function OnClientTabSelected(sender, args)
{
// Get the MyControl that is on this tab
var myControl = $find("whatever");
// Call a method that updates the display
myControl.doSomething();
}

View 2 Replies


Similar Messages:

Javascript - User Control With Client + Server Side CustomValidation; Wrong Client Side Validator Is Picked

Nov 23, 2010

I have a user control which contains a CustomValidator which is used according to whether a RadioButton is checked or not (there are several RadioButtons, I'm only showing the relevant one)

<asp:RadioButton runat="Server" ID="RadioBetween" GroupName="DateGroup" CssClass="date_group_options_control_radio" />
[code]...

There is some client + server side validation code (the server side code does exactly the same thing and is skipped for brevity)

<script type="text/javascript">
function ValidateDateFields_Client(source, args) [code]...

There are two instances of this control in the page. When running the client side version it hits the wrong one (the version of the control which is disabled). You can see from the generated HTML both are correctly specified. I'm not sure how .NET works out which clientside function to call given they both have the same name.

<script type="text/javascript">
//<![CDATA[
var ctl00_MCPH1_QueryTextValidator = document.all ? document.all["ctl00_MCPH1_QueryTextValidator"] : document.getElementById("ctl00_MCPH1_QueryTextValidator");

[code]...
Do i need to add something in to scope it? What's the best way to achieve this? If I disable the loading of the second control everything works fine.

View 1 Replies

Javascript - Enhance A Composite Control's Client Side, My Approach Is To Recreate All Method On JavaScript?

Aug 30, 2010

I want to enhance a composite control's client side, my approach is to recreate all method on JavaScript, so here I have some troubles:Can I call onclick event on client side otherwise on server side?the statement table.onclick=SelectRow(event) fires a bug!Code:

function Control_Init() {
if( !(document.getElementById) ) { return; }
for( var i = 0; i < Controls.length; i++ ) {

[code]...

View 1 Replies

How To Force The User To Have At Least One Selected Checkbox And Postback From Client-side JavaScript

Jul 8, 2010

I have two checkboxes: cb1 and cb2. They are both hooked up to an onClick event which checks if at least one checkbox is clicked. If this is not the case, it throws an alert and reverts the change. If a legal change was made (e.g. cb2 was checked, followed by cb1 being unchecked), the function calls the server function checkChange() which needs the object and eventargs.

I'm having trouble with the following:

Reverting the change: how can i find out which checkbox was clicked without adding an extra javascript function for the second checkbox? This has to be a scalable solution as more checkboxes may be added later.
How do I call the server function checkChange(). I am aware of "this.Page.GetPostbackEventReference" but I am confused as to the parameters it takes.

View 1 Replies

AJAX :: Tab Control Change Tab On Client Side (javascript)?

Jan 24, 2010

I am using ajax tab control,is there anyway to switch from tab1 to tab2 on client click of any element?

View 1 Replies

Client Side Click Event Of Control In User Control Doesn't Work?

Jun 14, 2010

I have a webdayview control (Infragistics proprietary ASP.net control) on my page. On the aspx source I've inserted some javascript (webdayview_click - clientside click event) that calls a webmethod in the codebehind. This seems to work fine, but when I
insert this webdayview control into a user control and move the corresponding javascript into the aspx of the user control, it doesn't work. I can't even insert a breakpoint into the javascript function to debug it. Is there a way to make it work? I want to enable the click event of the webdayview control so that when I click on it, the javascript function calls the webmethod. Here's my code (remember it is inside a user control):

[code]...

I posted this question on the Infragistics forum but didn't get any replies. Hopefully I'll get some here. :)

View 2 Replies

Client Side Javascript Call From Control Doesn't Reset Visibility?

Jan 3, 2010

I have a javascript to enable text boxes when called, I want to trigger this code when a user picks value "Custom" from a dropdownlist, so that I can display/Hide these new textboxes.

function setVisibility(DropDownListID) {
var element = document.getElementById(DropDownListID);
var element1 = document.getElementById("TestBox1");
if (element.value == "Custom") {
element1.visible = !element1.visible ;
}
<asp:DropDownList ID="DateRangeDropDownList" runat="server" Enabled="True" onChange="setVisibility('DateRangeDropDownList');">
<asp:ListItem>Some Value</asp:ListItem>
<asp:ListItem>Custom</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TestBox1" runat="server"></asp:TextBox>

For some reason it doesn't seem to work.

View 1 Replies

Web Forms :: How To Add Some Client Side Functionality To A User Control

Feb 28, 2011

I am trying to add some client side functionality to a user control that I have written.

A really simplified version of my scenario is as follows:

I have a control called MyControl. This has a javascript method called doSomething that simply shows the current date and time in an alert box.I add an instance of MyControl to a page called WebForm1. I want to be able to call myControl1.doSomething when a regular (non ASP.NET) button on WebForm1 is pressed.

I'm sure this is really simple but I can't for the life of me figure out what I need to do make doSomething available.

View 7 Replies

Client Side Event That Occurs On A User Control When Its Parent Submits To The Server?

Sep 8, 2010

Is there a client side event that occurs on a user control when its parent submits to the server?

View 1 Replies

Access Server Side Variable On Client Side And Vice Versa And JavaScript?

Dec 9, 2010

I have a requirement of adding server side variables in client side and other way round. Because I need to set a value from client side using javascript and access the same in code behind page.

I have to use C#.Net and JavaScript.

View 2 Replies

JavaScript - Exposing Server-side State Through Client-side Controls

Feb 11, 2011

I have a list of items on an ASP.net page. That list is selectable in that whenever the user clicks on one, the page does a postback and the server code stores the index or some unique identifier of the picture in a ViewState property indicating that it is currently selected.

I would like to minimize the load on the server and therefore I would like to store the index or unique identifier representing the image in some way on the client side. The best way I can think to do this is to store said information in a hidden field ), however I had two questions about this before I go crazy:

Is this a security risk in any way, shape or form (i.e., exposing implementation details of the page)?
Is there a better/best way to do this that is more industry-standard? Does ASP.net provide a framework to do this that is cleaner than my idea? Seems like this would be a fairly common requirement to me...

View 1 Replies

C# - Calling Server Side Function From Client Side JavaScript?

Sep 14, 2010

Possible Duplicates: how to call server side function from client side - asp.net Calling ASP.NET Code Behind function from Javascript Calling ASP.NET server side method via JQuery While loading an aspx page, how is it possible to call a server side method with the client side code?Can u show one example?

View 4 Replies

JavaScript - Pass Arguments From Client Side To Server Side?

Feb 11, 2011

I have two comboboxes and would like pass selected value and text to the server method (RadComboBoxItemsRequestedEventArgs) when the first combobox selected index changed.

Here is my code. But I am getting Javascript error message at this line. RadComboBox2.requestItems(item, false).

[code]....

View 1 Replies

JavaScript - Detecting Client-side DOM Changes Server-side - Is It Possible

Mar 7, 2010

I'm working on developing a custom control to select items from a predefined list. This is accomplished via 2 ASP.NET ListBox controls, with a few buttons to trigger the movement of ListItems from one ListBox to the other (lets call these ListBoxes lstSelected and lstDeselected).

This is easy enough to do in ASP.NET or JavaScript independently: I have both working. However, if modifications are made via JavaScript, ASP.NET retains no knowledge of this. Is there any way to register the creation of of options in a select tag without AJAX?

View 2 Replies

How To Convert Server Side Vb.net To Client Side Javascript

Mar 20, 2010

I've got a function I wrote quite some time ago that works fine, but I'd like to speed up the process and lessen server load by doing the same job in Javascript.I seem to be able to GET textbox values ok, but I can't seem to SET textbox values (I'm'-a JS noob). Can anyone lend a hand in converting my VB.NET code to it's JS equivalent?

Protected Sub txtSellingPrice_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles txtSellingPrice.TextChanged
Dim SellingPrice As Double = Double.Parse(txtSellingPrice.Text.Replace("$", ""))
[code]...

View 2 Replies

Javascript - Get The Value Of Client Side Variable In Server Side?

Mar 24, 2011

I want to ask how to get the value of var title :

From this code :

protected void btnSubmit_Click(object sender, EventArgs e)
{
string script = "var title = $('.rsApt').attr('title');";
ClientScript.RegisterStartupScript(GetType(),"popup", script, true);
}

View 2 Replies

Web Forms :: How Do You Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox

[Code]....

but got a readonly error.

View 10 Replies

Web Forms :: Retrieve Value If Server Side Control Value Is Updated On Client Side

Oct 26, 2010

I have a hidden variable and its value is being updated using javascript(client side) which I make a call from server side code. After making the call I am not able to retrieve the updated value from Server side variable. I went through this forum [URL] but not able find a way how to implement functionality with IFRAME. I am trying to call the client side code and retrieve the updated value from server side in page_load event.

View 5 Replies

Server Side Control Hidden - Possible To Read Values Client Side

Jan 30, 2010

I've got two textboxes running server side and have their visibility turned off. I'm using a couple of ASP.NET controls which require the textboxes to exist. However, I am filling them from the code behind and would not like the user to see this. Can the user turn the visibility on and see the values entered in the text box? I tried using FireBug, and I couldn't seem to select the visibility option in order to edit it. However, I'm quite new to Firebug, so there may be another way? Or does running it server side mean that the client can't ever view the contents of the textbox?

View 1 Replies

How To Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox: I can retrieve the value using Request.Form. But how do I go about populating this textbox from the server-side? I tried Request.Form["txtTest"] = "blah"; but got a readonly error.

View 2 Replies

Web Forms :: Dynamic Control Server Side Event Is Not Firing If We Set Client Side Events?

Aug 27, 2010

I have created dynamic control with both server and client side events.. if i set client side event server side event is not firing.. I have created the link button which will validate and do some necessary actions.. Validation is working but click event of link button is not firing .. if we remove the client side event , server side event is firing.. how to avoid this.. I want both events..

View 2 Replies

Web Forms :: How To Transfer Control To Client Side From Server Side

Dec 9, 2010

I have a requirement in which I have to call a JavaScript function in between my server side event and in that JavaScript function code I have to set hidden field value and in next line of that same event i have to use that hidden field value.

View 4 Replies

How To Get Same Validators Control To Both Client Side And Server Side

May 20, 2010

For the ASP.NET validator controls, I want to use both client-side validation for the user experience and server-side validation to guard against hackers. ASP.NET documentation leads me to believe that if EnableClientScript="True" then there will be no server-side validation if client-side validation is possible for the user agent. To get server-side validation, the documentation says use EnableClientScript="False", which bypasses client-side validation altogether.

Am I misunderstanding how the validator controls work? I ask because it seems obvious that many developers would want both client and server side validation together, and I find it hard to believe both together is not possible with one of the standard validation controls.

If I am understanding the ASP.NET documentation correctly, then I can find only two options:

Use two validator controls exactly the same except for their ID and EnableClientScript properties. Obviously ugly for maintaining two controls almost the same.Write some code behind to check if postback then invoke the Validate method on the validator group. Why write code behind if there a way to be automatic from the control?

Is there a way to do so using a single validator control with no code behind?

View 4 Replies

AJAX :: Can Send An Object From Client-side JavaScript To Server-side Code Via AJAX

Mar 16, 2011

I know that I can receive an javascript object from the server via ASP.NET AJAX using Json. But I am not sure how can I send an javascript object from my client-side javascript to my server-side code. And if I can, how can I extract this object in my server-side code and access its members?

View 1 Replies

Javascript - Client Side Validation And Server Side Validation In Java Script And Respectively ?

Sep 6, 2010

want to know that can we validate a control which is out side a form element in asp.net(server side validation)and outside a form element in html(client side validation) let's take a closer look

<html>
<body>
<input type="text" name="first name"/>
</body>
</html>

can we apply clien side validation on above text box by java script ?in asp.net

<form runat="server">
</form>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved