C# 如何在事件中更改输入参数时使用Angular JS更新页面
我有一个使用webform(.aspx)、C#和一些Javascript的有效解决方案。在学习使用Angular JS时,我需要一些帮助 我正在寻找一种方法,将解决方案重新编写为AngularJS应用程序中的页面。示例页面有一个Dropdownlist服务器控件,当选择一个项目时,必须根据页面成员“configJson”的当前值更新div“axviewer”。configJson是一个从静态C#方法返回的值,该方法将SelectedItem作为输入C# 如何在事件中更改输入参数时使用Angular JS更新页面,c#,angularjs,C#,Angularjs,我有一个使用webform(.aspx)、C#和一些Javascript的有效解决方案。在学习使用Angular JS时,我需要一些帮助 我正在寻找一种方法,将解决方案重新编写为AngularJS应用程序中的页面。示例页面有一个Dropdownlist服务器控件,当选择一个项目时,必须根据页面成员“configJson”的当前值更新div“axviewer”。configJson是一个从静态C#方法返回的值,该方法将SelectedItem作为输入 从你的问题中我可以理解,你想做的事情似乎并不
从你的问题中我可以理解,你想做的事情似乎并不复杂,但我建议你首先自己尝试一下 我可以给你一些提示 首先,在angular中有一个自定义指令来模拟您根据所选项目操作DIV所做的操作 暗示 然后使用ng select指令更改下拉选择。 如果你是初学者,我建议你先用这个来在你的头脑中清楚地描绘出什么是角的 我希望这能解决你的问题
<html> <head>
<title>ActiveX Viewer Sample Launch Page</title>
<script type="text/javascript">
$(document).ready(function () {
// configJson is updated and returned by a C# public static method
// based on the selection in the list
var ax = igc.be.client.activex.createInstance(<% =configJson %>);
ax.render("axviewer");
});
</script> </head> <body>
<form runat="server">
<input type="button" id="prev" value='<' />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" >
<asp:ListItem>288</asp:ListItem>
<asp:ListItem>483</asp:ListItem>
<asp:ListItem>488</asp:ListItem>
<asp:ListItem>501</asp:ListItem>
</asp:DropDownList>
</form>
<hr />
<%--Display the Brava Viewer--%>
<div id="axviewer"></div>
<div id="errorMesage" runat="server" visible="false">
<asp:Label runat="server" ForeColor="Red" ID="Description">Something is wrong!</asp:Label>
</div> </body> </html>
protected void Page_Load(object sender, EventArgs e)
{
errorMesage.Visible = false;
string docId = "273";
try
{
// return a json config string
var selectedId = this.DropDownList1.SelectedValue;
instanceId = this.DropDownList1.SelectedValue;
configJson = ActiveXViewer.GetViewerConfigJson(instanceId, "admin:admin", docId);
}
catch (Exception ex)
{
errorMesage.Visible = true;
Description.Text = ex.Message;
}
}