protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
GridViewRow selectRow = GridView1.Rows[e.NewSelectedIndex];
string strId = selectRow.Cells[0].Text;
if (BLL.updatepro.CountNum(strId) == 0)
{
Response.Write("<script>alert('没有数据,请添加数据');</script>");
FormView1.ChangeMode(FormViewMode.Insert);
}
else
{
if (FormView1.CurrentMode != FormViewMode.ReadOnly)
{
FormView1.ChangeMode(FormViewMode.ReadOnly);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
FormView1.ChangeMode(FormViewMode.Edit);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList6_SelectedIndexChanged(object sender, EventArgs e)
{
HiddenField hi = (HiddenField)FormView1.FindControl("eid");
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList6");
hi.Value = dr6.SelectedValue;
SqlDataSource3.UpdateParameters["creatEmployId"].DefaultValue = hi.Value;
// Response.Write(SqlDataSource3.InsertParameters[1].DefaultValue);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList7_SelectedIndexChanged(object sender, EventArgs e)
{
HiddenField hi = (HiddenField)FormView1.FindControl("eid7");
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList7");
hi.Value = dr6.SelectedValue;
SqlDataSource3.UpdateParameters[6].DefaultValue = hi.Value;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
{
HiddenField hi = (HiddenField)FormView1.FindControl("eid4");
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList4");
hi.Value = dr6.SelectedValue;
SqlDataSource3.UpdateParameters[7].DefaultValue = hi.Value;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void SqlDataSource3_Updating(object sender, SqlDataSourceCommandEventArgs e)
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
if (SqlDataSource3.UpdateParameters[7].DefaultValue == null)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList4");
SqlDataSource3.UpdateParameters[7].DefaultValue = dr6.Text;
}
if (SqlDataSource3.UpdateParameters[6].DefaultValue == null)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList7");
SqlDataSource3.UpdateParameters[7].DefaultValue = dr6.Text;
}
if (SqlDataSource3.UpdateParameters["creatEmployId"].DefaultValue == null)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList6");
SqlDataSource3.UpdateParameters["creatEmployId"].DefaultValue = dr6.Text;
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList3");
SqlDataSource3.InsertParameters[1].DefaultValue = dr6.SelectedValue;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList2");
SqlDataSource3.InsertParameters[6].DefaultValue = dr6.SelectedValue;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList5");
SqlDataSource3.InsertParameters[7].DefaultValue = dr6.SelectedValue;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
{
if (SqlDataSource3.InsertParameters[7].DefaultValue == null)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList5");
SqlDataSource3.InsertParameters[7].DefaultValue = dr6.Text;
}
if (SqlDataSource3.InsertParameters[6].DefaultValue == null)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList2");
SqlDataSource3.InsertParameters[6].DefaultValue = dr6.Text;
}
if (SqlDataSource3.InsertParameters["creatEmployId"].DefaultValue == null)
{
DropDownList dr6 = (DropDownList)FormView1.FindControl("DropDownList3");
SqlDataSource3.InsertParameters["creatEmployId"].DefaultValue = dr6.Text;
}
}