当我单击添加按钮但缺少某些内容并且不知道它是什么时,我在使用添加和删除模式弹出窗口创建响应表时有一段代码。有人可以帮我吗?
<%--mpeAddUpdateEmployee Modal Popup Extender For pnlAddUpdateEmployeeDetails--%>
<uc:modalpopupextender id="mpeAddUpdateEmployee" runat="server" popupcontrolid="pnlAddUpdateEmployeeDetails"
targetcontrolid="lnkFake" behaviorid="mpeAddUpdateEmployee" cancelcontrolid="btnCancel"
backgroundcssclass="modalBackground">
</uc:modalpopupextender>
<%--lnkFake1 Link Button for mpeDeleteEmployee ModalPopup as TargetControlID--%>
<asp:LinkButton ID="lnkFake1" runat="server"></asp:LinkButton>
<%--pnlDeleteEmployee Panel With Design--%>
<asp:Panel ID="pnlDeleteEmployee" runat="server" CssClass="modalPopup" Style="display: none;">
<div id="Div1" runat="server" class="header">
</div>
<div style="overflow-y: auto; overflow-x: hidden; max-height: 450px;">
<div class="form-group modal-body">
<div class="row">
<div class="col-md-12">
Do you Want to delete this record ?
</div>
</div>
</div>
</div>
<div align="right" class="modal-footer">
<div class="row">
<div class="col-md-12">
<asp:HiddenField ID="hfDeleteEmployeeId" runat="server" Value="0" />
<asp:Button ID="btnYes" runat="server" Text="Yes" OnClick="Yes" class="btn btn-danger">
</asp:Button>
<button id="btnNo" runat="server" class="btn btn-default">
Cancel
</button>
</div>
</div>
</div>
</asp:Panel>
<%-- mpeDeleteEmployee Modal Popup Extender For pnlDeleteEmployee--%>
<uc:ModalPopupExtender ID="mpeDeleteEmployee" runat="server" PopupControlID="pnlDeleteEmployee"
TargetControlID="lnkFake1" BehaviorID="mpeDeleteEmployee" CancelControlID="btnNo"
BackgroundCssClass="modalBackground">
</uc:ModalPopupExtender>
此处有C#代码
protected void Edit(object sender, EventArgs e)
{
/* Change label text of lblHeading on Edit button
Click */
lblHeading.Text = "Update Employee Details";
/* Sets CommandArgument value to hidden field
hfAddEditEmployeeId */
hfAddEditEmployeeId.Value = (sender as
Button).CommandArgument;
/* Sets value from Grid cell to textboxes
txtName,txtCountry and txtSalary */
txtName.Text = ((sender as Button).NamingContainer as
GridViewRow).Cells[1].Text;
txtCountry.Text = ((sender as Button).NamingContainer
as GridViewRow).Cells[2].Text;
txtSalary.Text = ((sender as Button).NamingContainer
as GridViewRow).Cells[3].Text;
/* Change text of button as Update*/
btnSave.Text = "Update";
/* Apply Bootstrap Collapse and Expand Class for Grid
cells attribute */
BootstrapCollapsExpand();
/* Show AddUpdateEmployee Modal Popup */
mpeAddUpdateEmployee.Show();
}
/*Add Employee Detail*/
protected void Add(object sender, EventArgs e)
{
/* Clear Controls Value */
ClearControls();
/* Apply Bootstrap Collapse and Expand Class for Grid cells attribute */
BootstrapCollapsExpand();
/* Show mpeAddUpdateEmployee Modal Popup */
mpeAddUpdateEmployee.Show();
}
/* Save or Update Employee Details*/
protected void Save(object sender, EventArgs e)
{
/* Code For INSERT OR UPDATE */
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
/* Set employeeId from hfAddEditEmployeeId value for INSERT or UPDATE */
int employeeId = Convert.ToInt32(hfAddEditEmployeeId.Value);
string query = string.Empty;
/* To Check Employee Id For Insert or Update and sets query string variable text*/
if (employeeId > 0)
{
query = "UPDATE Employee SET Name = @Name, Country = @Country, Salary = @Salary WHERE Id = @Id";
}
else
{
query = "INSERT INTO Employee(Name, Country, Salary) VALUES(@Name, @Country, @Salary)";
}
SqlCommand cmd = new SqlCommand(query);
if (employeeId > 0)
{
cmd.Parameters.AddWithValue("@Id", employeeId);
}
cmd.Parameters.AddWithValue("@Name", txtName.Text.Trim());
cmd.Parameters.AddWithValue("@Country", txtCountry.Text.Trim());
cmd.Parameters.AddWithValue("@Salary", txtSalary.Text);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
/* Bind Employee Grid*/
BindEmployee();
/* Hide mpeAddUpdateEmployee Modal Popup */
mpeAddUpdateEmployee.Hide();
/* Clear Controls Value */
ClearControls();
}
/* Delete Emploee Detail*/
protected void Delete(object sender, EventArgs e)
{
/* Apply CommandArgument value to hidden field hfDeleteEmployeeId */
hfDeleteEmployeeId.Value = (sender as Button).CommandArgument;
/* Apply Bootstrap Collapse and Expand Class for Grid cells attribute*/
BootstrapCollapsExpand();
/* Show DeleteEmployee Modal Popup */
mpeDeleteEmployee.Show();
}
/* If Select Yes on Delete Modal Popup */
protected void Yes(object sender, EventArgs e)
{
/* Code to Delete Employee Record */
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
int EmployeeId = Convert.ToInt32(hfDeleteEmployeeId.Value);
SqlCommand cmd = new SqlCommand("DELETE FROM Employee WHERE Id = @Id");
cmd.Parameters.AddWithValue("@Id", EmployeeId);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
/* Bind Grid Again To see latest Records*/
BindEmployee();
/* Hide Delete Employee Modal Popup */
mpeDeleteEmployee.Hide();
/*Clear Controls Value*/
ClearControls();
}
Designer中的uc无法识别为标签前缀或设备。
mpeAddUpdateEmployee.hide()在当前上下文中不存在
mpeAddUpdateEmployee.show()在当前上下文中不存在
请帮助我解决这些错误。