gridview编辑时报错 格式说明符无效?
如题 --------------------编程问答-------------------- 这个一般都是数据类型不匹配的问题,楼主把代码贴点出来吧。 --------------------编程问答-------------------- 代码? --------------------编程问答-------------------- protected void btConfirm_Click(object sender, EventArgs e){
#region 选择方式
this.Panel1.Visible = false;
if (this.rbSelectbook.SelectedValue == "0")
{
this.Label2.Text = "";
this.BindAll();
}
if (this.rbSelectbook.SelectedValue == "1")
{
if (this.tbSearchInformation.Text == "")
{
this.Label2.Text = "请输入书名";
}
else
{
this.BindBookName();
}
}
if (this.rbSelectbook.SelectedValue == "2")
{
if (this.tbSearchInformation.Text == "")
{
this.Label2.Text = "请输入编号";
}
else
{
this.BindISBN();
}
}
#endregion
}
。。。。。
public void BindAll()
{
#region 绑定全部图书
Data dt = new Data();
DataSet ds = dt.GetAllBook();
this.gvBooksInfor.DataSource = ds;
this.gvBooksInfor.DataKeyNames = new string[] { "SD_BookID" };
this.gvBooksInfor.DataBind();
#endregion
}
public void BindBookName()
{
#region 按书名绑定
string BookName = this.tbSearchInformation.Text;
Data dt = new Data();
DataSet ds = dt.GetBookNameSelect(BookName);
this.gvBooksInfor.DataSource = ds;
this.gvBooksInfor.DataKeyNames = new string[] { "SD_BookID" };
this.gvBooksInfor.DataBind();
#endregion
}
public void BindISBN()
{
#region 按编号绑定
int BookID = Convert.ToInt32(this.tbSearchInformation.Text);
Data dt = new Data();
DataSet ds = dt.GetBookIDSelect(BookID);
this.gvBooksInfor.DataSource = ds;
this.gvBooksInfor.DataKeyNames = new string[] { "SD_BookID" };
this.gvBooksInfor.DataBind();
#endregion
}
public void BindVoice()
{
#region 绑定全部音像
Data dt = new Data();
DataSet ds = dt.GetAllVoice();
this.gvShowVoice.DataSource = ds;
this.gvShowVoice.DataKeyNames = new string[] { "SD_VoiceID" };
this.gvShowVoice.DataBind();
#endregion
}
。。。
if (this.rbSelectbook.SelectedValue == "0")
{
this.gvBooksInfor.EditIndex = e.NewEditIndex;
this.BindAll();
}
if (this.rbSelectbook.SelectedValue == "1")
{
this.gvBooksInfor.EditIndex = e.NewEditIndex;
this.BindBookName();
}
if (this.rbSelectbook.SelectedValue == "2")
{
this.gvBooksInfor.EditIndex = e.NewEditIndex;
this.BindISBN();
} --------------------编程问答-------------------- 能不能给个解答,我今天也遇到这个问题了,高手指点一下吧,谢谢了
补充:.NET技术 , ASP.NET