This is the usercontrol which has a grid and On clicking Add new a usercontrol is added in the pageview.
protected void Page_Load(object sender, EventArgs e)
{
RadAjaxManager AjaxMan = this.Page.Master.FindControl("MasterAjaxManager") as RadAjaxManager;
if (!Page.IsPostBack)
{
RadMultiPage rmpUser = (this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("RadMultiPage1") as RadMultiPage);
RadTabStrip rtsUser = (this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("RadTabStrip1") as RadTabStrip);
AjaxMan.AjaxSettings.AddAjaxSetting(rgAttendeeList, rmpUser);
AjaxMan.AjaxSettings.AddAjaxSetting(rgAttendeeList, rtsUser);
AjaxMan.AjaxSettings.AddAjaxSetting(rgAttendeeList, rgAttendeeList);
}
}
protected
void rgAttendeeList_ItemCommand(object source, GridCommandEventArgs e)
{
RadTabStrip rtsUser = (this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("RadTabStrip1") as RadTabStrip);
RadMultiPage rmpUser = (this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("RadMultiPage1") as RadMultiPage);
Label lblInfo = (this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblInfo") as Label);
ClearSession();
switch (e.CommandName)
{
case "InitInsert":
if (e.CommandArgument.ToString().Equals("Copy"))
{
////LastOperation = "Copy";
System.
Guid userId = new System.Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserId"].ToString());
UserService.
UserClient proxyUser = new ePlannerPro2Client.UserService.UserClient();
System.
Guid eventId = new System.Guid(Session["EventId"].ToString());
try
{
Session.Add(
"CopyUser", proxyUser.LoadById(userId, eventId));
}
catch { }
finally
{
if (proxyUser != null)
{
proxyUser.Close();
proxyUser =
null;
}
}
}
else
{
LastOperation =
"Insert";
}
//e.Canceled = true;
DestroyOldPageViews();
GoToNextPageView(rtsUser.Tabs[1]);
break;
case "Edit":
if (Session["CreateUsers"] != null)
{
epp2ClientPL.
UsersProperties[] users = Session["CreateUsers"] as epp2ClientPL.UsersProperties[];
if (users != null && users.Count() > 0)
{
System.
Guid eventAttendeeId = new System.Guid(e.Item.Cells[4].Text);
epp2ClientPL.
UsersProperties user = users.Where(u => u.EventAttendeeId == eventAttendeeId).SingleOrDefault();
if (user != null && user.UserName.Length > 0)
{
lblInfo.Attributes[
"style"] = "visibility:visible";
lblInfo.Text =
"You are working for : " + user.SalutationName + " " + user.FullName;
rtsUser.Tabs[1].Enabled =
true;
rtsUser.Tabs[2].Enabled = user.EligibleForTravel;
rtsUser.Tabs[3].Enabled = user.EligibleForAccommodation;
rtsUser.Tabs[4].Enabled =
true;
rtsUser.Tabs[5].Enabled =
true;
rtsUser.Tabs[1].Selected =
true;
Session.Add(
"EditUser", user);
DestroyOldPageViews();
GoToNextPageView(rtsUser.Tabs[1]);
}
}
}
LastOperation =
"Edit";
e.Canceled =
true;
break;
case "Cancel":
//LastOperation = "Cancel";
break;
}
}
private void GoToNextPageView(RadTab radTab)
{
RadMultiPage multiPage = (this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("RadMultiPage1") as RadMultiPage);
RadPageView PersonalInfoPageView = multiPage.FindPageViewByID("PersonalInfo");
radTab.Selected =
true;
radTab.Enabled =
true;
if (PersonalInfoPageView == null)
{
PersonalInfoPageView =
new RadPageView();
PersonalInfoPageView.ID =
"PersonalInfo";
multiPage.PageViews.Add(PersonalInfoPageView);
radTab.PageViewID = PersonalInfoPageView.ID;
}
PersonalInfoPageView.Selected =
true;
radTab.PageView.Selected =
true;
}