请c#.net能人帮我看一下这个页面的程序
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#336666" BorderStyle="Double" DataKeyNames="id"
BorderWidth="1px" CellPadding="4" OnRowCreated="GridView1_RowCreated"
style="font-size: x-small" Width="100%" OnRowDataBound="GridView1_RowDataBound" >
<RowStyle BackColor="White" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<HeaderStyle Width="10px" />
<ItemTemplate>
<%# Eval("id") %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="qd_name" HeaderText="qd_name" SortExpression="qd_name" >
<HeaderStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="hd_date" DataFormatString="{0:d}" htmlencode="False" HeaderText="hd_date" SortExpression="hd_date" >
<HeaderStyle Width="10%" />
</asp:BoundField>
<asp:BoundField DataField="hd_place" HeaderText="hd_place" SortExpression="hd_place" >
<HeaderStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="our_contact" HeaderText="our_contact" SortExpression="our_contact" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="his_contact" HeaderText="his_contact" SortExpression="his_contact" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="his_tel" HeaderText="his_tel" SortExpression="his_tel" />
<asp:BoundField DataField="yiji" HeaderText="yiji" SortExpression="yiji" />
<asp:BoundField DataField="huli" HeaderText="huli" SortExpression="huli" />
<asp:BoundField DataField="market" HeaderText="market" SortExpression="market" />
<asp:BoundField DataField="qita" HeaderText="qita" SortExpression="qita" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="total" HeaderText="total" SortExpression="total" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="total_maybe" HeaderText="total_maybe" SortExpression="total_maybe" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:TemplateField HeaderText="dis_type">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
<asp:HiddenField ID="hfId" runat="server" Value='<%# Eval("Id")%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle Width="10px" />
<ItemTemplate>
<%=mycount %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="xuanquance" HeaderText="xuanquance" SortExpression="xuanquance" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="shilibiao" HeaderText="shilibiao" SortExpression="shilibiao" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="shibaoka" HeaderText="shibaoka" SortExpression="shibaoka" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="yuyuejieche" HeaderText="yuyuejieche" SortExpression="yuyuejieche" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="jmdj" HeaderText="jmdj" SortExpression="jmdj" >
<HeaderStyle Width="5%" />
</asp:BoundField>
</Columns>
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White"
HorizontalAlign="Left" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
</asp:GridView>
---------------------------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
HiddenField hf =(HiddenField) e.Row.FindControl("hfId");
if ((DropDownList)e.Row.FindControl("DropDownList1") != null)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
con.Open();
DropDownList DropDownList1 = (DropDownList)e.Row.FindControl("DropDownList1");
string sql = "SELECT * FROM shichan_dis where hd_id="+hf.Value;
Session["hdid"] = hf.Value;
SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
DataSet dataset = new DataSet();
con.Close();
adapter.Fill(dataset);
DropDownList1.DataSource = dataset;
DropDownList1.DataTextField = "dis_type";
DropDownList1.DataValueField = "hd_id";
DropDownList1.DataBind();
}
}
public void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList DropDownList1 = sender as DropDownList;
int index = (DropDownList1.NamingContainer as GridViewRow).RowIndex;
string id = GridView1.DataKeys[index].Value.ToString();
string sql = "SELECT * FROM shichan_hd INNER JOIN shichan_dis ON shichan_dis.hd_id = shichan_hd.id where shichan_hd.id=" + id;
DataTable dt = Class1.ExecSel(sql);
mycount = dt.Rows[0]["dis_count"].ToString();
}
怎么触发不了这个public void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
事件啊
BackColor="White" BorderColor="#336666" BorderStyle="Double" DataKeyNames="id"
BorderWidth="1px" CellPadding="4" OnRowCreated="GridView1_RowCreated"
style="font-size: x-small" Width="100%" OnRowDataBound="GridView1_RowDataBound" >
<RowStyle BackColor="White" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<HeaderStyle Width="10px" />
<ItemTemplate>
<%# Eval("id") %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="qd_name" HeaderText="qd_name" SortExpression="qd_name" >
<HeaderStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="hd_date" DataFormatString="{0:d}" htmlencode="False" HeaderText="hd_date" SortExpression="hd_date" >
<HeaderStyle Width="10%" />
</asp:BoundField>
<asp:BoundField DataField="hd_place" HeaderText="hd_place" SortExpression="hd_place" >
<HeaderStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="our_contact" HeaderText="our_contact" SortExpression="our_contact" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="his_contact" HeaderText="his_contact" SortExpression="his_contact" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="his_tel" HeaderText="his_tel" SortExpression="his_tel" />
<asp:BoundField DataField="yiji" HeaderText="yiji" SortExpression="yiji" />
<asp:BoundField DataField="huli" HeaderText="huli" SortExpression="huli" />
<asp:BoundField DataField="market" HeaderText="market" SortExpression="market" />
<asp:BoundField DataField="qita" HeaderText="qita" SortExpression="qita" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="total" HeaderText="total" SortExpression="total" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="total_maybe" HeaderText="total_maybe" SortExpression="total_maybe" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:TemplateField HeaderText="dis_type">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
<asp:HiddenField ID="hfId" runat="server" Value='<%# Eval("Id")%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle Width="10px" />
<ItemTemplate>
<%=mycount %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="xuanquance" HeaderText="xuanquance" SortExpression="xuanquance" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="shilibiao" HeaderText="shilibiao" SortExpression="shilibiao" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="shibaoka" HeaderText="shibaoka" SortExpression="shibaoka" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="yuyuejieche" HeaderText="yuyuejieche" SortExpression="yuyuejieche" >
<HeaderStyle Width="5%" />
</asp:BoundField>
<asp:BoundField DataField="jmdj" HeaderText="jmdj" SortExpression="jmdj" >
<HeaderStyle Width="5%" />
</asp:BoundField>
</Columns>
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White"
HorizontalAlign="Left" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
</asp:GridView>
---------------------------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
HiddenField hf =(HiddenField) e.Row.FindControl("hfId");
if ((DropDownList)e.Row.FindControl("DropDownList1") != null)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
con.Open();
DropDownList DropDownList1 = (DropDownList)e.Row.FindControl("DropDownList1");
string sql = "SELECT * FROM shichan_dis where hd_id="+hf.Value;
Session["hdid"] = hf.Value;
SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
DataSet dataset = new DataSet();
con.Close();
adapter.Fill(dataset);
DropDownList1.DataSource = dataset;
DropDownList1.DataTextField = "dis_type";
DropDownList1.DataValueField = "hd_id";
DropDownList1.DataBind();
}
}
public void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList DropDownList1 = sender as DropDownList;
int index = (DropDownList1.NamingContainer as GridViewRow).RowIndex;
string id = GridView1.DataKeys[index].Value.ToString();
string sql = "SELECT * FROM shichan_hd INNER JOIN shichan_dis ON shichan_dis.hd_id = shichan_hd.id where shichan_hd.id=" + id;
DataTable dt = Class1.ExecSel(sql);
mycount = dt.Rows[0]["dis_count"].ToString();
}
怎么触发不了这个public void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
事件啊
...全文
相关推荐
基于asp.net c#在线答题页面
首先,我们需要理解ASP.NET的基础。ASP.NET是由微软提供的一个用于构建Web应用程序的框架,它支持C#作为主要的编程语言。
ASP.NET的几个试题(《C#与.NET程序员面试宝典》)
更多参考:博客园笔记 面试题1:ASP.NET是什么 ASP.NET不是一种语言,而是创建动态Web页的一种强大的服务器端技术,它是Microsoft.NET Framework中一套用于生成Web应用程序和Web服务的技术,,利用公共语言运行时(Common Language Runtime)在服务器后端为用户提供建立强大的企业级Web应用服务的编程框架。 ASP.NET页在服
asp.net(C#)刷新页面6中方法
"ASP.NET(C#)刷新页面的6种方法"在ASP.NET(C#)开发中,有时我们需要实现页面的自动或手动刷新功能,以更新显示的信息或执行某些操作。以下将详细介绍6种不同的刷新页面的方法,以满足
C#,ASP.NET页面中文乱码解决方法
### 标题解析:“C#, ASP.NET 页面中文乱码解决方法”此标题明确指出了讨论的主题——在使用C#和ASP.NET进行Web开发时,遇到的中文乱码问题及其解决方案。
一周学会C# java程序员转.NET必看
【一周学会C#——java程序员转.NET必看】C#是一种由微软开发的面向对象的编程语言,设计用于.NET Framework上。


