I have a custom entity 1:m to opportunity .. The grid on the opportunity tab shows the data from the custom entity and has + to add new data..
When the insert page loads, I have some code that gathers all the closed products for the opportunity and lists them in a combobox.. I have some code on the OnChange event of the combobox that changes a label providing the user with directions based upon the selection in the combobox..
The issue is that the OnChange event on server side posts a row to the database, and then after adding more data to the form and saving posts a second row ...
So I am thinking if I can move the onChange event to client side with some javascript then I can change the label on the form w/o posting back..
Does anyone have an example of how I can do this..?
I have so far tried adding to the load actions the following:
this.cmbProduct.Attributes.Add("onchange",
"Javascript: var switch(this.cmbProduct.SelectedValue){case (Air Export): case(Air Import): L.ForeColor = System.Drawing.Color.Red;L.Font.Size = System.Web.UI.WebControls.FontUnit.Point(10);");
However, this doesn't seem to fire.
I thought about adding an external .js file but not quite sure how to register it correctly:
ScriptManager.RegisterStartupScript(Page, this.GetType(), "CallJS", "JSFunctionName();", true);
the example above I don't know how to change to call the external file..
Does anyone have an example of something like this so I can figure this out..?
|