Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...DNN 4.5.3 Using ClientAPI in C# QuestionDNN 4.5.3 Using ClientAPI in C# Question
Previous
 
Next
New Post
3/3/2008 4:57 PM
 

I am attempting to pass the selected value from a dropdownlist to a client side function but my code throws a 'Object reference not set to an instance of an object' exception when I try to register the client side variable. Please take a look and see if you can help.

in the .ascx file I have

<asp:DropDownList ID="DDL_Report_List" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DDL_Report_List_SelectedIndexChanged" />

<script type="text/javascript" src="/js/des.js"></script> 

In the ascx.cs file in the page load I have:

 protected void Page_Load(object sender, EventArgs e){protected void DDL_Report_List_SelectedIndexChanged(object sender, EventArgs e)  

{

  if (!IsPostBack)    

   {ReportingService2005 rs = InstantiateRS(); 

 

     Get_Report_List(rs);

     Bind_DDL_Report_List(DDL_Report_List); }

  else  {

if (DDL_Report_List.SelectedIndex != 0) {

 

     strURL = DDL_Report_List.SelectedValue;

     if(ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))

     ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn); 

     try     {ClientAPI.RegisterClientVariable(this.Page, "rURL", strURL, true);}   //THIS IS THE LINE THAT THROWS THE EXCEPTION

     catch (Exception ex){ string temp = ex.ToString();}

    DDL_Report_List.SelectedIndex = 0;

  }

}

 

And then

 

string getReport = DDL_Report_List.SelectedValue; 

if(DDL_Report_List.SelectedIndex==2) //set global variable

strURL = @"http://10.0.3.40/Reports/Pages/Report.aspx?ItemPath=/BrokerReports/" + getReport;}

else //set global variable

strURL = @"http://10.0.3.40/Reports/Pages/Report.aspx?ItemPath=/BrokerReports/" + getReport + "?ReportID=CPC1&Firm=E&&rc:parameters=False&rc:Toolbar=false"

}

 In the js file I have:

function

{

var url = dnn.getVar('rURL');

 

window.open(url, "one", "left=10, top=10, width=600, height=800, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=no, toolbar=no");

}

I have read the ClientAPI help doc and thik I may have to use ClientAPI.RegisterPostBackEvent, but can't quite grasp everything I am to do. Any help would be greatly appreciated. Thanks in advance

GetRpt()

protected void DDL_Report_List_SelectedIndexChanged(object sender, EventArgs e)

private string strURL;

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...DNN 4.5.3 Using ClientAPI in C# QuestionDNN 4.5.3 Using ClientAPI in C# Question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out