[英]ASP.NET Event not firing
所以我有一個事件,它基本上檢查我是否已經添加到發貨中。 我在inventoryBLL inv = new inventoryBLL();
設置了一個斷點inventoryBLL inv = new inventoryBLL();
它永遠不會中斷。 有趣的是,我可以毫不費力地獲取索引。
我的C#
protected void rblSwitch1_SelectedIndexChanged(object sender, EventArgs e)
{
inventoryBLL inv = new inventoryBLL();
List<string> asinholder = new List<string>();
List<string> fnskuholder = new List<string>();
int Index = new int();
asinwrapper asin = asinwrapper.GetSessionWrapper();
if (asin != null)
{
fnskuholder = asin.FNSKU;
asinholder = asin.ASIN;
Index = asin.Index;
}
List<shipmentdetail> detail = new List<shipmentdetail>();
multipleshipments m = multipleshipments.GetSessionWrapper();
if (m != null)
{
detail = m.Detail;
}
inventory.ItemCheckDataTable items = inv.GetItem(asinholder[Index], detail[0].Id[ddlExisting1.SelectedIndex]);
if (items.Rows.Count < 0)
{
foreach (inventory.ItemCheckRow row in items)
{
txt.Text = row.Quantity;
}
}
}
這是HTML
<asp:RadioButtonList ID="rblSwitch1" runat="server"
onselectedindexchanged="rblSwitch1_SelectedIndexChanged">
<asp:ListItem Value="0">New Shipment</asp:ListItem>
<asp:ListItem Value="1">Existing Shipment</asp:ListItem>
</asp:RadioButtonList>
將AutoPostBack = "true"
添加到您的標簽。 應該是這樣:
<asp:RadioButtonList ID="rblSwitch1" runat="server" AutoPostBack="true"
onselectedindexchanged="rblSwitch1_SelectedIndexChanged">
<asp:ListItem Value="0">New Shipment</asp:ListItem>
<asp:ListItem Value="1">Existing Shipment</asp:ListItem>
</asp:RadioButtonList>
如果不是由控件的AutoPostBack
設置為false引起的,請檢查AutoEventWireup
是否設置為false。 可以在多個位置進行設置,包括頁面標題和配置文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.