所以我有一个事件,基本上检查我是否已经添加到货件。我在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>
答案 0 :(得分:4)
将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>
答案 1 :(得分:1)
如果它不是由AutoPostBack
控件设置为false引起的,请检查AutoEventWireup
是否设置为false。它可以在几个地方设置,包括页面标题和配置文件。