Ich arbeitete auf einer Seite mit mehreren Dropdown-Steuerelemente, auf jedem Dropdown ausgewählten Index ändert Ereignis Ich wollte eine Nachricht im modalen Popup anzeigen, und damit zeigte ich das modale Popup Mit einem Label auf diesem und dynamisch geändertem Label-Wert aus dem Code hinter dem JS-Funktionsaufruf wird der Wert geändert, aber nicht auf der Webseite wiedergegeben. hier ist der Code-Schnipsel:Etikett Text aktualisiert über Javascript aber nicht auf der Webseite
C# -Code:
public void Page_Load(object sender, EventArgs e)
{
//builds page controls
this._BuildControls();
if (IsPostBack)
{
// get the target of the post-back, will be the name of the control
// that issued the post-back
string eTarget = Request.Params["__EVENTTARGET"].ToString();
//source database server dropdown changes event called
if (eTarget.Contains("SourceDatabaseServer"))
{
this._DisplayMessage = "Loading source database...";
}
else if (eTarget.Contains("SourceDatabaseName"))
{
this._DisplayMessage = "Loading source host name...";
}
else if (eTarget.Contains("DestinationDatabaseServer"))
{
this._DisplayMessage = "Loading destination database...";
}
else if (eTarget.Contains("DestinationDatabaseServer"))
{
this._DisplayMessage = "Loading destination host name...";
}
else
{
this._DisplayMessage = "Cloning portal...";
}
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "updateMessage('" + this._DisplayMessage + "');", true);
}
}
Javascript-Datei-Funktion:
function updateMessage(message){
var text = document.getElementById('LoadAndSaveClonePortalDataModalModalPopup');
text.innerHTML=message;
}