Question

I am working on SharePoint Application pages. I have a SharePoint DropDownChoiceField control on the aspx page. The requirement is to auto populate this control at the time of page load.

  1. Is there a way to call a JavaScript function at any of the events say "onload"?
  2. I am also unable to find this control on the code behind page.

    SharePoint:DropDownChoiceField FieldName="DropDownOptions" ID="ListValue" runat="server">

Thanks

Was it helpful?

Solution

Why are you not using ASP.NET Drop down list control instead?

You can use _spBodyOnLoadFunctionNames.push("myCustomFunctionName"); to make your JavaScript function run on load.

OTHER TIPS

You can call javascript from code behind as:

Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","MyFunction()",true);

where MyFunction() is your javascript function

http://www.codeproject.com/Questions/443131/Call-to-javascript-Function-from-code-behind-using

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top