大体程序要求如下:
选择DropDownList GridView 显示出相应的内容 ,单击Button 按钮 GridView执行对应的操作 ,但是现在出现这么一个问题, 我单击Button GridView 自动就消失了...但是通过选DropDownList GridView会出现 并且发现Button按钮所执行的操作执行了 经过测试发现单击GridView中自带的编辑按钮时也会出现GridView消失的情况..代码如下:
ddlartCat01为DropDownList ID
btnadd为button ID protected void Page_Load(object sender, EventArgs e)
{
conn = new SqlConnection(strconn);
if (!IsPostBack)
{
ddlartCat01.Items.Insert(0, new ListItem("请选择:", "0"));
}
}
protected void btnadd_Click(object sender, EventArgs e)
{
gvartCat01.ShowFooter = true;
}
protected void ddlartCat01_SelectedIndexChanged1(object sender, EventArgs e)
{
int idLang = Convert.ToInt32(ddlartCat01.SelectedIndex.ToString()) - 1;
string artCat01Liststr = "select idCat01,qtyCat02,descData from vw_artCat01 where idLang='" + Convert.ToString(idLang) + "'";
SqlDataSource2.SelectCommand = artCat01Liststr;
conn.Open();
SqlCommand artCat01cmd = new SqlCommand(artCat01Liststr, conn);
artCat01da = new SqlDataAdapter(artCat01Liststr, conn);
artCat01da.Fill(artCat01ds, "vw_artCat01");
BindGrid();
artCat01cmd.Dispose();
}
选择DropDownList GridView 显示出相应的内容 ,单击Button 按钮 GridView执行对应的操作 ,但是现在出现这么一个问题, 我单击Button GridView 自动就消失了...但是通过选DropDownList GridView会出现 并且发现Button按钮所执行的操作执行了 经过测试发现单击GridView中自带的编辑按钮时也会出现GridView消失的情况..代码如下:
ddlartCat01为DropDownList ID
btnadd为button ID protected void Page_Load(object sender, EventArgs e)
{
conn = new SqlConnection(strconn);
if (!IsPostBack)
{
ddlartCat01.Items.Insert(0, new ListItem("请选择:", "0"));
}
}
protected void btnadd_Click(object sender, EventArgs e)
{
gvartCat01.ShowFooter = true;
}
protected void ddlartCat01_SelectedIndexChanged1(object sender, EventArgs e)
{
int idLang = Convert.ToInt32(ddlartCat01.SelectedIndex.ToString()) - 1;
string artCat01Liststr = "select idCat01,qtyCat02,descData from vw_artCat01 where idLang='" + Convert.ToString(idLang) + "'";
SqlDataSource2.SelectCommand = artCat01Liststr;
conn.Open();
SqlCommand artCat01cmd = new SqlCommand(artCat01Liststr, conn);
artCat01da = new SqlDataAdapter(artCat01Liststr, conn);
artCat01da.Fill(artCat01ds, "vw_artCat01");
BindGrid();
artCat01cmd.Dispose();
}
解决方案 »
- 什么是MVC模式和ORM原理
- 画图的问题
- 如何把数据库的数据读到 XML中,显示相应的xml格式?
- winfrom与数据库
- 为什么Device device=(Device)sender会报错
- C#如何用delegate调用C++的DLL中以回调函数为参数的函数(比较拗口上代码。)
- 保留2位小数的问题!
- 执行insert语句时出错,commandtext does not return a result set 麻烦帮忙看看啊!
- c#如何获取选中的单选框的Text,急求答案!
- 看到一篇文章作者实现三层结构师这样做的 请问老师 这样对吗?感觉~怪!(详见)
- 随机生成无重复数字问题
- 探讨树型结构数据的建表与显示方式
{
gvartCat01.ShowFooter = true;
BindGrid(); }