大家好我所拥有的名为 ApprovalStatus 的文件。如果这是 N ,我想显示一个弹出窗口,显示您是否要批准此员工。如果确定我想编辑并将状态更新为 Y ,然后允许用户编辑所选行。
这就是我写的
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
{
int iPagecount = RadGrid2.MasterTableView.CurrentPageIndex;
if (e.Item is GridDataItem)
{
if (iPagecount == 0)
{
if (e.Item.ItemIndex != 0)
{
GridDataItem item = (GridDataItem)e.Item;
ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];
imageButton.Visible = false;
//imageButton.ImageUrl = "images/MailOk.png";
}
else
{
GridDataItem item = (GridDataItem)e.Item;
ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];
imageButton.Visible = true;
}
}
else
{
GridDataItem item = (GridDataItem)e.Item;
ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];
imageButton.Visible = false;
}
}
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = e.Item as GridEditableItem;
mlocal_strStoredProcName = StoredProcNames.Gender_uspGenderGetList;
oEmployeePersonalData.Select(out mlocal_ds, mlocal_strStoredProcName);
Label lblStatus = (Label)item.FindControl("lblApprovalStatus1");
if (lblStatus.Text == "Y")
{
if (!e.Item.OwnerTableView.IsItemInserted)
{
Label LBL1 = (Label)item.FindControl("lblMaritalStatus");
RadComboBox rdcmbGender = (RadComboBox)item.FindControl("rdcbGender");
rdcmbGender.DataSource = mlocal_ds;
rdcmbGender.DataTextField = TablesAndColumns.tblGender_GenderDesc;
rdcmbGender.DataValueField = TablesAndColumns.tblGender_GenderTypeID;
rdcmbGender.SelectedValue = (string)DataBinder.Eval(e.Item.DataItem, "MaritalTypeID").ToString();
//rdcmbGender.SelectedValue = LBL1.Text;
rdcmbGender.DataBind();
mlocal_strStoredProcName = USADAO.StoredProcNames.PayFrequency_uspPayFrequencySelect;
oEmployee.FedTaxID = Session["FedTaxID"].ToString();
oEmployee.Select(out mlocal_ds, mlocal_strStoredProcName);
RadComboBox ddlPayFrequencytype = (RadComboBox)item.FindControl("rdcbPayFrequency");
ddlPayFrequencytype.DataSource = mlocal_ds;
ddlPayFrequencytype.DataTextField = "PayFrequencyDesc";
ddlPayFrequencytype.DataValueField = "PayFrequencyType";
ddlPayFrequencytype.DataBind();
ddlPayFrequencytype.Enabled = false;
mlocal_ds.Clear();
RadDatePicker radDtStartDate = item.FindControl("radDtStartDate") as RadDatePicker;
RadDatePicker radDtEndDate = item.FindControl("radDtEndDate") as RadDatePicker;
strDate = radDtStartDate.SelectedDate.Value;
EndDt = radDtEndDate.SelectedDate.Value;
}
}
else
{
rdwndwPersonal.RadConfirm("Are you sure?", "confirmCallBackFn", 300, 100, null, "My Confirm"); // Here If **OK** was clicked I would like to set **e.Item.Edit = true;** if cancel was clicked I would like to set **e.Item.Edit = false;**
}
}
}
但我无法按照要求实现,有人可以帮助我。