同志们啊,谁帮我一下啊!(在线等啊!!)
我的代码是这样写的,可是怎么读不出来呢:protected void gvProductName_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("server = .;uid = sa;pwd = sa;database = Company");
SqlCommand com = new SqlCommand("select ProductImage from Product where ProductName = '"+Request.QueryString["name"]+"'", con);
con.Open();
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
byte[] aa = (byte[])dr["ProductImage"];
for (int i = 0; i < aa.Length; i++)
{
FileStream fs = new FileStream("C:\\Image", FileMode.OpenOrCreate);
fs.Write(aa, 0, aa.Length);
fs.Close();
}
con.Close();
//this.Image3.ImageUrl = "C:\\aa";
for (int i = 0; i < 3; i++)
{
TableRow row = new TableRow();
for (int j = 1; j <= 3; j++)
{
TableCell cell = new TableCell();
cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
cell.Width = 42;
cell.Height = 42;
cell.Text = "<img src=\"C:\\Image\">";
row.Cells.Add(cell);
}
tabImage.Rows.Add(row);
}
}
}
为什么gvProductName_SelectedIndexChanged不执行呢? --------------------编程问答-------------------- 设置AutoPostBack为真 --------------------编程问答-------------------- 该回复被版主删除 --------------------编程问答-------------------- 调一下看看。 --------------------编程问答-------------------- 设置 gvProductName AutoPostBack = true --------------------编程问答-------------------- AutoPostBack="true"
或者
OnSelectedIndexChanged="gvProductName_SelectedIndexChanged" --------------------编程问答-------------------- autopostback=true --------------------编程问答-------------------- 我设了,可是报的错是autopostback找不到,这是怎么回事呢? --------------------编程问答-------------------- gvProductName是droplist的话则
如下设置:
类型:<asp:DropDownList ID="dlSrvTyp" runat="server" AutoPostBack="True" OnSelectedIndexChanged="dlSrvTyp_SelectedIndexChanged">
</asp:DropDownList>
如果是htmlcontrols,可以调用form1.submit() --------------------编程问答-------------------- 不是,是一个GridView,但是我在HTML视图里设这个时没有啊,不能自动弹出来,当我手动加上时,又报错了!
补充:.NET技术 , ASP.NET