在网上做了大量的研究后,我仍然对这个问题感到难过.我有一个页面,将名称和类别数加载到下拉列表中.我只会这样做!(Page.IsPostBack).当AutoPostBack发射时SelectedIndex = 0.我尝试过几种不同的东西.这是我的代码:
页
<form id="AddAssignmentForm" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<asp:UpdatePanel ID="CommentUpdate" runat="server">
<ContentTemplate>
Add Comment
<asp:DropDownList ID="ddlCategory" runat="server" Width="206" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged" AutoPostBack="true" />
<asp:TextBox ID="txtName" runat="server" Width="200" />
<asp:TextBox ID="txtAbbrv" runat="server" Width="200" />
<asp:TextBox ID="txtDescription" runat="server" Width="200" Height="90" TextMode="MultiLine" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
Run Code Online (Sandbox Code Playgroud)
这是后端代码.
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
GetCategories();
}
}
public void GetCategories()
{
String strSql = @"SELECT Name, Total
FROM MyTable";
if (con.State == …Run Code Online (Sandbox Code Playgroud) 我正在这个混合环境中工作,我在Windows机器上使用Simics并Cygwin在类似unix的环境中运行一些代码.我一直用C编码,但我有兴趣尝试用Python做我的解决方案.在unix环境中找到SC_PAGE_SIZE你可以简单地做到:
#Python-2.7, unix environment
page_size = os.sysconf("SC_PAGE_SIZE")
Run Code Online (Sandbox Code Playgroud)
如果您使用c编码,则可以执行以下操作:
#C, unix environment
size_t page_size = (size_t) sysconf (_SC_PAGESIZE);
Run Code Online (Sandbox Code Playgroud)
但是在Windows os.sysconf中使用python时不存在,我一直无法找到替代品.我可以在python中使用什么来查找PAGE_SIZE环境.
旁注,我知道你可能想知道我为什么要使用设置,这不是我的选择.这是工作中的家庭作业.我问的问题是为了我自己的利益,不是为了做作业.