日期:2014-05-20  浏览次数:20529 次

困扰很久的下拉列表框问题
HTML代码:
<asp:datagrid   id= "DataGrid1 "   runat= "server "   Width= "100% "   BorderWidth= "1px "   BorderColor= "LightBlue "
AutoGenerateColumns= "False "   AllowPaging= "True "   GridLines= "Horizontal ">
<SelectedItemStyle   Wrap= "False "> </SelectedItemStyle>
<EditItemStyle   Wrap= "False "> </EditItemStyle>
<AlternatingItemStyle   Wrap= "False "   BackColor= "#EBEBEB "> </AlternatingItemStyle>
<ItemStyle   Wrap= "False "> </ItemStyle>
<Columns>
<asp:BoundColumn   DataField= "ID "   HeaderText= "ID ">
<HeaderStyle   Width= "80px "> </HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn   HeaderText= "操作 ">
<ItemTemplate>
<FONT   face= "宋体 ">
<asp:DropDownList   id= "DropDownList1 "   runat= "server "   OnSelectedIndexChanged= "DropDownList1_SelectedIndexChanged "
AutoPostBack= "True ">
<asp:ListItem   Value= "操作 "> 操作 </asp:ListItem>
<asp:ListItem   Value= "0 "> 详细信息 </asp:ListItem>
<asp:ListItem   Value= "1 "> 销售报告 </asp:ListItem>
<asp:ListItem   Value= "2 "> 合同信息 </asp:ListItem>
<asp:ListItem   Value= "3 "> 填写销售报告 </asp:ListItem>
</asp:DropDownList> </FONT>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

</asp:datagrid>
事件代码:
Sub   DropDownList1_SelectedIndexChanged(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)
                Dim   dg   As   DataGridItem
                For   Each   dg   In   DataGrid1.Items
                        Dim   mydd   As   DropDownList   =   dg.FindControl( "DropDownList1 ")
                        Select   Case   mydd.SelectedValue
                                Case   0
                                      Response.Redirect( "inf.aspx?id= "   +   ID)
                                Case   1
                                      Response.Redirect( "inf1.aspx?id= "   +   ID)                  
                                Case   2
                                        Response.Redirect( "inf2.aspx?id= "   +   ID)