如何给Gridview下的DropDownList 添加一个OnSelectedIndexChanged事件
哪位大哥帮忙看下,顺便写下怎么添加:<asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False...
哪位大哥帮忙看下,顺便写下怎么添加:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound"
OnRowCommand="GridView1_RowCommand" OnRowUpdating="GridView1_RowUpdating" AllowPaging="True"
PageSize="5" OnPageIndexChanging="GridView1_PageIndexChanging" OnSorting="GridView1_Sorting"
OnRowDeleting="GridView1_RowDeleting" Width="99.5%">
<PagerSettings FirstPageText="首页" LastPageText="尾页"
Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
<Columns>
<asp:ButtonField Text="SingleClick" CommandName="SingleClick" Visible="False" />
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lbID" runat="server" Visible="true" Text='<%# Eval("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="质检项目">
<ItemTemplate>
<asp:Label ID="lbQualityProjectName" runat="server" Visible="true" Text='<%# Eval("QualityProjectName") %>'></asp:Label>
<asp:DropDownList ID="ddlQualityProjectName" runat="server" OnSelectedIndexChanged="DropOnSelectedIndexChanged" Visible="false" AutoPostBack="true"> </asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="" ShowDeleteButton="True"/>
</Columns>
</asp:GridView>
CS文件中的方法:
private void DropOnSelectedIndexChanged(Object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)GridView1.FindControl("ddlQualityProjectName");
QC_FormulateQualityStandard myQC_FormulateQualityStandard = new QC_FormulateQualityStandard();
_sampleData = myQC_FormulateQualityStandard.drpSelectChange(ddl.SelectedValue, AgoColumn);
}
错误提示:
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误消息: CS1061: “ASP.qcs_config_qc_formulatequalitystandard_aspx”不包含“DropOnSelectedIndexChanged”的定义,并且找不到可接受类型为“ASP.qcs_config_qc_formulatequalitystandard_aspx”的第一个参数的扩展方法“DropOnSelectedIndexChanged”(是否缺少 using 指令或程序集引用?)
上以个问题已经解决:如下一个问题
一个表结构和数据集中的表结构一样,我现在要将数据集中的表中的一行记录添加到这个表中该如何添加! 展开
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound"
OnRowCommand="GridView1_RowCommand" OnRowUpdating="GridView1_RowUpdating" AllowPaging="True"
PageSize="5" OnPageIndexChanging="GridView1_PageIndexChanging" OnSorting="GridView1_Sorting"
OnRowDeleting="GridView1_RowDeleting" Width="99.5%">
<PagerSettings FirstPageText="首页" LastPageText="尾页"
Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
<Columns>
<asp:ButtonField Text="SingleClick" CommandName="SingleClick" Visible="False" />
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lbID" runat="server" Visible="true" Text='<%# Eval("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="质检项目">
<ItemTemplate>
<asp:Label ID="lbQualityProjectName" runat="server" Visible="true" Text='<%# Eval("QualityProjectName") %>'></asp:Label>
<asp:DropDownList ID="ddlQualityProjectName" runat="server" OnSelectedIndexChanged="DropOnSelectedIndexChanged" Visible="false" AutoPostBack="true"> </asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="" ShowDeleteButton="True"/>
</Columns>
</asp:GridView>
CS文件中的方法:
private void DropOnSelectedIndexChanged(Object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)GridView1.FindControl("ddlQualityProjectName");
QC_FormulateQualityStandard myQC_FormulateQualityStandard = new QC_FormulateQualityStandard();
_sampleData = myQC_FormulateQualityStandard.drpSelectChange(ddl.SelectedValue, AgoColumn);
}
错误提示:
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误消息: CS1061: “ASP.qcs_config_qc_formulatequalitystandard_aspx”不包含“DropOnSelectedIndexChanged”的定义,并且找不到可接受类型为“ASP.qcs_config_qc_formulatequalitystandard_aspx”的第一个参数的扩展方法“DropOnSelectedIndexChanged”(是否缺少 using 指令或程序集引用?)
上以个问题已经解决:如下一个问题
一个表结构和数据集中的表结构一样,我现在要将数据集中的表中的一行记录添加到这个表中该如何添加! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询