.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

CalendarExtender javascript event properties

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

I am trying to validate the date selected in a CalenderExtender using JavaScript (we want to limit the selections to certain Mondays of the year).  I am able to get the selected date using sender._selectedDate.  However if the date is not a valid date, I'd like to change the text color of the associated text box.  So I have 2 questions/requests:

1.  How can you change the text color of the associated text box?  I tried using sender._textbox.style.color = "red", but that doesn't seem to work.

2. Is there a site/page that has the complete documentation on the ajax controls javascript object properties?  I just happened to run across a site that showed how to get the selecteddate/textbox using the properties like I did above.  If there was somewhere where I could see all those properties that would help me a ton.



View Complete Post

More Related Resource Links

how to impose javascript event processing?


If I have some form control like textbox and I want the event handler to be located in the html instead of at the server side, how to do that? Of course I can copy paste javascript code in the aspx file. But is it possible to do that using some object oriented approach (ie programmatically in the code behind)?


Closing Javascript Modal dialog window after server side event processing


Hello Friends..

Please tell me how to close Javascript ModelDoalog Window.. after Server Side event Processing .

Basically i want close window in  finally Block After sucessfulll Updation.

AMit..... InnocentInnocentInnocentInnocentInnocentInnocentInnocent

Trap Selected Index change event of listbox using Javascript.

Hi All, This is reagarding listbox selection. I have a list box with multi select option. I want to trap the selected index change event of Listbox through javascript. Item of list box can be selected using Click of mouse and also the keyboard up down key with shift. I tried onclick event to bind the javascript function. It works fine if I select by mouse, but it doesen't work for up/down key of keyboard. Thanks, Naveen

modify/override properties of default sharepoint modal dialogs (ex. editview.aspx) using javascript

Hello all, I would like to know how can I modify (override) some properties of the default sharepoint modal dialogs using Javascript. Ex. the size and location of editview.aspx. I while ago I asked a question about overriding the DialogResult in the display view dialog. I got an answer from Zach which looked like this:             sb.Append("<script type=\"text/javascript\">");             sb.Append(@"window.setTimeout(function () {");             sb.Append(@"if (window.frameElement && typeof(window.frameElement.overrideDialogResult) == 'function')");             sb.Append(@"{");             sb.Append(@"SP.SOD.executeFunc('sp.ui.dialog.js', 'SP.UI.DialogResult.OK', function () {");             sb.Append(@"window.frameElement.overrideDialogResult(SP.UI.DialogResult.OK); ");             sb.Append(@"});");             sb.Append(@"}");  

raise click event from javascript

HiI want to raise click event on linkbutton, when press "Enter ?" on textbox.I wrote this code:LinkButton1.Attributes.Add("onclick", myscript);but, can not call LinkButton1.onclick() , my linkbutton:href='javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Login1$lbtEnter",%20"",%20true,%20"LoginGroup",%20"",%20false,%20true))'when call ctl00$ContentPlaceHolder1$Login1$lbtEnter.onclick();Error: ctl00_ContentPlaceHolder1_Login1_lbtEnter is not define

Viewstate issue when calling button click event from Javascript

I have a javascript that asks a confirmation on search click. If the user has made some changes to the data in grid (gridview) on click of Search, a confirmation is asked to Save or Continue Search. If Yes, Save the records by invoking Save click from javascript. If No, Search click is invoked. While Search click happens correctly, Save click results in an error which reads like this..  "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. " I know the Viewstate is what causing the problem, where the control is not loaded but script is trying to invoke it's click event. Any help is appreciated. At the end of the day, all i need is to invoke Save click from javascript.   -- Viswanth VG  

Execute Javascript from Sharepoint Event Handler

Hello, I want to execute a sample java script function from itemadding event of sharepoint event handler.  How can i achieve this? Please Help.   Thanks in Advance

Keeping Custom properties in GridView Added on OnRowDataBound Event While Sorting

All of my columns are bound in the Gridview. On OnRowDataBound event, I am adding some custom styles like underlines and colors to the text of the columns. Sorting of data is working fine but I am losing my custom styles when I sort. I am using the generic sorting code for the GridView. How I can keep my custom styles on sorting that I added during OnRowDataBound event.   Thanks for your help.

Javascript Unload event

Hi,   Just a quick general question about javascript. Is it possible for the browser unload event not to fire sometimes? I have a webmethod that fires at the time the user closes , presses back, presses forward or refreshes the asp.net page.   Any known bugs in browsers that may prevent unload events from firing sometimes? I would like to hear somebody's opinion on this.    Thanks

Calling Button,s onclick event in javascript code


 Hi Experts.

I have a Button control in webpage.

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="test()"/>

When i click on button, i want to check some conditions

How can i safe value of variables in javascript code in PostBack event?


Hi Experts.

I need to define some Boolean variables in my javascript code and use them  when  the any onfocusout methods of controls  is fired. Like this:


            Var is_ValidateTextBox1 = false;

            Var is_ValidateTextBox2 = false;

            Var is_ValidateTextBox3 = false;

Function focusout_TextBox1()

{ValidateTextBox1 = true; }


When onfocusout of TextBox1 is fire, I want to set  " is_ValidationTextBox1=true;".  But when the post back is fired from the form, the variable reset to false because the line of defining the "Var is_ValidateTextBox1 = false;" is run again in post back!

Now how can I to solve this problem? How can i safe value of variables in javascript code in PostBack event?

With Regards. Mojtaba

DataGrid control properties not updating on resize event


I have a DataGrid control on a form and I'm binding it to an ArrayList that is populated dynamically as the user scrolls.  The array list is pre-populated with blank records equal in number to the number of records in the DB.  As the user scrolls, if they stop in a place where there are blank records I populate that data from the DB.  I'm using the VisibleRowCount and VertScrollBar.Value properties to determine where I am in the DataGrid.  


The problem is that if I scroll to the bottom of the control then maximize the control it's resize event fires, the VertScrollBar is redrawn proportionally to the number of records, but the Value and VisibleRowCount remain unchanged.  If I then grab and scroll the scroll bar up then back down to the bottom, the Value and VisibleRowCount update correctly.  Is there a way for me to get these values some other way or to force the scroll bar to refresh/update manually?

Is it possible to get TextBox properties in javascript



Is it possible to get TextBox properties using javascript 

width, height.. like as

 If anybody have idea please let me know ..

thanks in advance




Onchange event for datetime field in javascript is not working?


I want to compare start date and end date when start date is changed. If start date is big, on change event i need to make the end date the same as start date.

So I wrote On change event for start date. But it doesnot work  

getField('input','Start Time').onchange = function() {showEndDate()};


function showEndDate()



var date1 = getField('input','Start Time');

var date2 = getField('input','End Time');


but its not firing at all. So you guys have any idea or any other way to do for datetime on change event?

WorkFlow Event Reveiver parameter "properties.ActivationProperties" is null.

I have been trying to write the event receiver on completion of my out of box "Approval - Sharepoint 2010 workflow" set on a Site Page library. I need to update some column on completion of the workflow.

So for this I need is the list and listItem to which the workflow is attached and the column that I need to update. I understand I can get this using "properties.ActivationProperties" but what I get is null value for this. Can someone help me in this regard? I also tried reading the same in workflowStarted event but even there I get the value as null.

How to trigger a JavaScript function using "onmouseover" event on a SPMenuField control?



I could do something along these lines for TemplateField (with ItemTemplate having a HyperLink control):

private void Grid1_RowDataBound(object sender, GridViewRowEventArgs e)
     if (e.Row.RowType == DataControlRowType.DataRow)    
          ((HyperLink)e.Row.FindControl("lnk_id")).Attributes.Add("onmouseover", "someFunction();");    

For SPMenuField, which control should I set the "onmouseover" event to?



How to call a javascript click event from ASPx?


this is kind of wierd but I need to use behindcode or aspx code to call a javascript click event.  The reason is because, I have two controls.  One control is a javascript controls tabs.  The other control is a panel.  The panel has a bunch of controls and depending on which tabs are being selected, the panel will switch to panel1,2,3,4 depending on if the user click tab1,2,3,4.

I've got the upper part programmed by using a __doPostback to the update panel.

However, in this case, I need to program the opposite because when the user switches the panel, the tab must be switched.

So here's what I got when a user clicks the tabs:

<a href="#" onclick="easytabs('1', '1');__doPostBack('UpdatePanel2', 'Tab1');return false;" onfocus="easytabs('1', '1');" title="" id="tablink1">

So I need a server side function such that when a user clicks <asp:LinkButton> or something, it will also call "easytabs('1','1');

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend