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


Top 5 Contributors of the Month
david stephan
Post New Web Links

Access PeopleEditor value using javascript

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :SharePoint
 
I had a need to do this and figured I would post my findings b/c it was a bit tricky.

Initially I tried to access the user with the following:

var names = document.getElementById('PE_CLIENT_ID').value;

where PE_CLIENT_ID is the ClientID of the PeopleEditor control.  This returned a boolean representing if there was a value in the control.

After investigating the source code for the control itself I discovered one PeopleEditor is made up of many html controls including:

<PE_CLIENT_ID>_OriginalEntities
<PE_CLIENT_ID>_hiddenSpanData
<PE_CLIENT_ID>_HiddenEntityKey
<PE_CLIENT_ID>_OuterTable
<PE_CLIENT_ID>

View Complete Post


More Related Resource Links

How To Access Datakeys In Javascript...and How To make gridview Column Visible true in javascript

  

How To Access Gridview's Datakeys In Javascript...and How To make gridview Column Visible true in javascript



Reply me..


How to access querystring values from javascript after url rewriting?

  
Hi mates, I´m using ASP.NET 3.5 with C#. The problem that I have is the following. I´m using url rewriting (in the Global.asax file) and people see urls like this:http://localhost:1855/uk/london but after I rewrite the urls I work internally with querystring values and the urls become somehting like this:http://localhost:1855/post.aspx?co=1&ci=1In my Global.asax after I create the proper url with the querystring values I just apply it with the following sentence (this is an example):Context.RewritePath("/post.aspx?co=1&ci=1");The problem is that from javascript using the following function I access the first url and not the second:function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } } I need to access the querystring values because I need to load values in a textbox using jQuery.autocomplete and Web Services. Can anyone tell me how to access the rewritten url to get the querystring values?Thanks in advance mates

Access UserControl Control from a JavaScript Function

  
I have a requirement to launch a Modal Javascript dialog box from within my usercontrol,I have done this by <code> function browseControlAction(ProjID,ControlID) { strPrompt = 'Select a Previous control action..'; strOptions = 'dialogWidth:25;dialogHeight:30;status:no;resizable:yes'; selectedAction = window.showModalDialog('browseControlActions.aspx?ProjID=' + ProjID + '&Control=' + ControlID, strPrompt, strOptions); var sControl = ' + ControlID + '; if (selectedAction != null) { alert(ControlID.toString()); alert(selectedAction); var sTest = ControlID + '_txtControlAction'; alert(sTest); var sTest2 = 'txtSummary'; alert(sTest2); document.getElementById('txtCurrentControls').innerText=selectedAction;   //this works as this a control on the page itself document.getElementById(sTest2).innerText=selectedAction;      //Ditto document.getElementById(sTest).innerText=selectedAction;    //This Fails as this is the control in the USercontrol I am trying to Access //__doPostBack('',''); }</code>can anybody tell me why I can't access the Textbox control on the USercontrol?

How to access ServerSide control Value in Javascript changed by Ajax

  
Hello,I have a Textbox whose value is been changed using ServerSide code (AJAX based - Partial postback) and now I want to access that changed value in JavaScript. Please suggest me that how can I access that value.document.getElementByID is displaying old value.Things work fine with full postback but are creating above issue with Partial Postback.Thanks, in Advance....

web service access from javascript

  
Hi,I am new to webservice accessing from javascript.I call a webmethod from javascript which returns a string array. whith this array i bind a dropdown list at client. At dropdownList selectedIndexchanged event I found there is no item in DropDownList. Is there any way how to bind the DropDownList using webMethod so that on postback i can get the dropdowns item.

Accordion control access in Javascript using Content page

  
Hi, I struggled with some javascript issues, and discovered that the problem seemes to come from a failed ajax control access.Here's my problem:I have a master page and a content page.In my content page, I have an accordion with 2 panes.1rst pane: a textbox and a validation button;                     I want the button to fire javascript function without reloading page (using "return false;");In my master page, I put my ToolkitScriptManager.In my content page, I put my script containing the functions.The problem is that it seems like I can't access the accordion control in my js functions, whereas I can access my textbox value...Here is my source:<%@ Page Language="C#" MasterPageFile="~/Default.master" Title="CLEOR RH | Home" CodeFile="Default.aspx.cs" Inherits="Default_aspx" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server"> <script type="text/javascript"> var step1 = false; function pageLoad() { var accCtrl = $find('AccordionCtrl_AccordionExtender');

Access Javascript from an aspx file through another aspx file

  
Hello, So.. I have a file called myFile.aspx which is linked to a js file called myJS.js    There is a file linked to an entirely different frame called theOtherFile.aspx.  I want to access a function is myJS.js called myFunc in theOtherFile.aspxI am not entirely sure how I would accomplish that..I am quite new to MVC2 and JS, so I am quite confused as to how to do this.  Any suggestions would be much appreciated.~Anath

Access an IFrame's body tag in javascript

  
I want to dynamically set some attributes in an IFrame (like textAlign).  I keep getting "undefined" for all the different things I try.  When I inspect the element, it seems as though I should be able to access the html > body tag from the iFrame object, but that is not the case:var myIFrame = document.getElementById("myIFrame"); alert(myIFrame.childNodes[0]); //Expecting "Html Node", getting "undefined" myIFrame.style.textAlign = "right"; //this does nothing even though I can set the style.textAlign attribute without the javascript failing, it doesn't do anything.  Looking at Chrome's element inspector, I'm able to get the desired result by placing an inline style on the body tag within the iFrame tag.

Not able to access child controls in user control using javascript

  

Hi

I have a user control "SettingsControl" containing an ajax:CollapsiblePanelExtender which in turn has a GridView (gridView) and checkBoxes. On top of GridView we have two LinkButtons "Select All" and "Clear All". I have written to enable select all and clear all functionality. Select All should select all the rows in the grid by calling the following JavaScript written on the Client .aspx file.

function SelectAll(chk)
{    
    //get reference of GridView control
    var grid = document.getElementById('<%= SettingsControl1.FindControl("gridView").ClientID %>');
    //variable to contain the cell of the grid
    var cell;

    if (grid.rows.length > 0)
    {
        //loop starts from 1. rows[0] points to the header.
        for (i=1; i<grid.rows.length; i++)
        {
            //get the reference of first column
            cell = grid.rows[i].cells[0];

         &nbs

AJAX/Telerik - Access Denied Javascript error

  

Hi all,

I have an app which loads a popup of a different app - ie cross domain browsing.  In the popup I also have telerik AJAX controls. 

When the user clicks on the close button on the page, using  :

RegisterCloseScript(Page, 1)

A javascipt error then appears, claiming Access Denied - line: 5959, which is:  

var offsetL = w.screenLeft - top.screenLeft - top.document.documentElement.scrollLeft + 2;
 I previously had issues with AJAX and telerik and have modified the MicrosoftAjax.js files as described in the links:
http://weblogs.asp.net/bleroy/archive/2007/01/31/how-to-work-around-the-quot-access-denied-quot-cross-domain-frame-issue-in-asp-net-ajax-1-0.aspx
http://blogs.msdn.com/delay/archive/2007/02/05/safely-avoiding-the-access-denied-dialog-how-to-work-around-the-access-denied-cross-domain-iframe-issue-in-the-ajax-control-toolkit.aspx 
..and changed the script manager to:
<asp:ScriptManager ID="ScriptManager1" runat="server"><Scripts><asp:ScriptReference Name="MicrosoftAjax.js" ScriptMode="Auto" Path="~/P

How to access child(.ascx) page control from parent page(.aspx) javascript

  

I have functionality to select All check boxes on grid rows.

Child User control is having grid with checkbox to select all rows of grid. I want to select individual cell html from each row when I select all rows when checkbox 'select all' is clicked and place it into textbox which is in Parent page.

This textbox can only be in parent page.

So i need to call child(.ascx) page control from parent page(.aspx) using javascript as follows.

function CheckUncheckChildren(event)
    {
        document
        debugger;
        var childChkBoxes = document.getElementById('<%=gvUserDetails.ClientID %>').getElementsByTagName("input");
        var childChkBoxCount = childChkBoxes.length;
        var evtelem = (isIE())?event.srcElement:event.currentTarget;
        if(evtelem.checked == true)
        {
            for(var i = 0; i<childChkBoxCount; i++)
            {   
    &nbs

Access control within a usercontrol from Javascript

  

I have a javascript embedded in my extended gridview control that reference the grid control. Example:

var DataGridObj = document.getElementById(GridView1);


 

where GridView1 is a variable and my calling program passes the grid name. This is ok if I place my extended gridview on aspx page and run. But, how if, I have gridview in a user control and that user control is being used in aspx?

My ASPX -> My User Control -> Extended GridView.

When I check the html code, my gridview has an ID of "UserControlID_ExtendedGridViewID". Example:

In Default.aspx

<uc1:MyGrid ID="MyGrid1" runat="server" />


In UserControl (MyGrid.ascx)

<cc1:ExtendedGridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1" </cc1:GridView>


and, finally in ExtendedGridView.cs

function CreateGridHeader(DataDiv, GridView1, HeaderDiv) 
{ 
    var DataGridObj = document.getElementById(GridView1);
//other part of code
}


HTML code:

<table cellspacing="0" rules="all" border="0" id="MyGrid1_GridView1&q

Access gridview row using javascript (row/cell index works in IE not in Firefox )

  

Hello All,

I have a gridview with checkboxes and textboxes. When i click on a checkbox i want the associated textbox to be enabled/disabled. I wrote the for following javascript that.

 for (var i = 1; i <= grid.rows.length - 1; i++) {
                   alert(grid.rows[i].cells[0].childNodes[2].checked);
                   if (grid.rows[i].cells[0].childNodes[2].checked) {
                       grid.rows[i].cells[1].childNodes[0].disabled = false;
                   }
                   else {
                      
                       grid.rows[i].cells[1].childNodes[0].disabled = true;
      &nbs

Access session variable in javascript

  

How can i access javascript variable in javascript????


ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

  
This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side
Categories: 
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