web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

pass values from javascript on crm to aspx page

(0) ShareShare
ReportReport
Posted on by 345

Hi here is my question..

i am working on online crm 2011

in a custom entity form, i have a javascript for a field here is it:

function getfieldvalue()
{

var s = Xrm.Page.data.entity.attributes.get('new_name').getValue();

if(s == null)                         
{
alert('Field value is empty');

Xrm.Page.getAttribute("new_name").setValue('empty');     
}
else
{
var url = 'http://localhost:1308/WebSite8/Default.aspx?namefield='+s; //Here is am passing the field value to aspx website
}
}

 

Here is a website code:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Specialized;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void  Button1_Click(object sender, EventArgs e)
    {
        label1.Text = HttpContext.Current.Request.QueryString["s"];
        //NameValueCollection n = Request.QueryString;
        //Label2.Text = n.GetKey(0);
        //Label3.Text = n.Get(0);
        if (HttpContext.Current.Request.QueryString["s"] == null)
        {
            label1.Text = "null value in query string";
        }
         
    }      
}

Request.querystring value is always null, Why is this. I checked that custom field has value. Nomatter what value "HttpContext.Current.Request.QueryString["s"]" always returns null, why is this??

All i am trying to do is passing crm field value to aspx page and make use of that value in aspx page..

Plz can anyone correct my above code or provide any code to make use of crm field value in hosted aspx page.

*This post is locked for comments

I have the same question (0)
  • Gus Gonzalez Profile Picture
    27,113 on at

    It seems as if it was trying to get the value from a different field instead of the "new_name" field.

    Do you get the same result if you put a different field name on the first script?

  • Taurus Profile Picture
    345 on at

    Hi,

    i have a valid url in variable url, but when i  assign it to iframe its not working. iframe is not displaying the resultant url window.

    i use one of the following ways of assigning, but not result. why is this??

    what is the different between these two following statements??

    crmForm.all.IFRAME_fileupload.src = url ;

    document.getElementById('IFRAME_fileupload').src = url;

  • Jhon Peter Profile Picture
    60 on at

    Hi,

    Did you resolve your problem??

  • Francisco Ceia Profile Picture
    35 on at

    Hi.

    May be I'm getting it wrong, but you are passing the variable in the querystring, correct? Have you checked the URL?

    You are building the URL like this:

    var url = 'http://localhost:1308/WebSite8/Default.aspx?namefield='+s;

    Then, you're fetching it on the code behind:

    label1.Text = HttpContext.Current.Request.QueryString["s"];

    Correct?

    You are trying to fetch the parameter "s" from the QueryString. It does not exist, hence the null value.

    Try to fetch it like this:

    label1.Text = HttpContext.Current.Request.QueryString["namefield"];

    Hope it helps.

    Regards,

    F

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans