my radgrid uses a WebUserControl for it's edit form. All of a sudden the edit and add new record quit working. and by quit working, i mean the editform does not open. no errors of anykind...nothing!!!
it was working and i can't figure out for the life of me what could've changed...i've got other grid's that do the same thing that are still fine...tried to compare them but can't find anything...
can someone help please?
(aspx file)
(aspx.cs file)
it was working and i can't figure out for the life of me what could've changed...i've got other grid's that do the same thing that are still fine...tried to compare them but can't find anything...
can someone help please?
(aspx file)
<%@ Page Language="C#" MasterPageFile="~/Master/BlenderMaster.master" AutoEventWireup="true" |
CodeFile="RefMDs.aspx.cs" Inherits="DevTools_RefMDs" Title="Ref MDs" ValidateRequest="false" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<%@ MasterType VirtualPath="~/Master/BlenderMaster.master" %> |
<script runat="server"> |
public string RadGrid1PanelClientID; |
protected void Page_Load(object sender, EventArgs e) |
{ |
RadAjaxManager.GetCurrent(Page).AjaxSettingCreated += new RadAjaxControl.AjaxSettingCreatedDelegate(refmds_aspx_AjaxSettingCreated); |
} |
void refmds_aspx_AjaxSettingCreated(object sender, AjaxSettingCreatedEventArgs e) |
{ |
if (e.Initiator.ID == "rgRefMDs") |
{ |
this.RadGrid1PanelClientID = e.UpdatePanel.ClientID; |
} |
} |
</script> |
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<style type="text/css"> |
html |
{ |
overflow:auto; |
} |
html, |
body, |
form, |
#<%= RadGrid1PanelClientID %> |
{ |
margin:0; |
height:100%; |
} |
.p{margin:0;padding:20px;font:12px/1.8 verdana,sans-serif} |
</style> |
</telerik:RadCodeBlock> |
</asp:Content> |
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server"> |
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="rgRefMDs"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rgRefMDs" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
<telerik:RadSplitter ID="RadSplitter1" Width="100%" Height="100%" runat="server" |
Orientation="Horizontal"> |
<telerik:RadPane ID="gridPane" runat="server" Scrolling="None"> |
<div id="PageTitleHeader"> |
<h1> |
Ref MDs |
</h1> |
</div> |
<div id="RadGridSearchHeader"> |
NPI:<asp:TextBox ID="txtNPI" runat="server" /> |
First:<asp:TextBox ID="txtFirst" runat="server" Class="PlainTextBox" Width="100" /> |
Last:<asp:TextBox ID="txtLast" runat="server" Class="PlainTextBox" Width="100" /> |
<asp:LinkButton ID="lnkSearch" CssClass="lnkIconButton Edit" runat="server" Text="Search" OnClick="lnkSearch_Click" /> |
<asp:LinkButton ID="lnkReset" CssClass="lnkIconButton Reset" runat="server" Text="Reset" OnClick="lnkReset_Click" /> |
</div> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" |
Width="75px" Transparency="25"> |
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' |
style="border: 0;" /> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadGrid ID="rgRefMDs" Skin="WebBlue" GridLines="None" runat="server" AllowAutomaticDeletes="False" |
AllowAutomaticInserts="False" Height="97%" Width="100%" AllowAutomaticUpdates="False" |
AllowPaging="False" AutoGenerateColumns="False" AllowFilteringByColumn="true" |
AllowSorting="true" OnNeedDataSource="rgRefMds_NeedDataSource" OnUpdateCommand="rgRefMds_UpdateCommand" |
OnItemDataBound="rgRefMds_ItemDataBound" onitemcommand="rgRefMDs_ItemCommand" |
oninsertcommand="rgRefMDs_InsertCommand"> |
<HeaderContextMenu Skin="WebBlue"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</HeaderContextMenu> |
<PagerStyle Mode="Slider" /> |
<MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="RefMdId" HorizontalAlign="NotSet" |
AutoGenerateColumns="False" EditMode="PopUp"> |
<Columns> |
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" |
HeaderStyle-Width="2%" /> |
<telerik:GridBoundColumn DataField="npi.number" HeaderText="NPI" SortExpression="npi.number" |
UniqueName="npi.number" HeaderStyle-Width="15%" /> |
<telerik:GridBoundColumn DataField="fullname" HeaderText="Name" SortExpression="fullname" |
UniqueName="fullname" HeaderStyle-Width="25%" /> |
<telerik:GridBoundColumn DataField="Contact.Address.City" HeaderText="City" SortExpression="Contact.Address.City"" |
UniqueName="city" HeaderStyle-Width="25%" /> |
<telerik:GridBoundColumn DataField="Contact.Address.StateCode" HeaderText="State" |
SortExpression="Contact.Address.StateCode" UniqueName="state" HeaderStyle-Width="15%" /> |
<telerik:GridCheckBoxColumn DataField="isactive" HeaderText="Active" SortExpression="isactive" |
UniqueName="iscompleted" EditFormColumnIndex="1" /> |
</Columns> |
<EditFormSettings UserControlName="RefMDs.ascx" EditFormType="WebUserControl" |
PopUpSettings-Modal="true" PopUpSettings-Width="60%" > |
<EditColumn UniqueName="EditCommandColumn1"> |
</EditColumn> |
</EditFormSettings> |
</MasterTableView> |
<ClientSettings> |
<Scrolling AllowScroll="True" UseStaticHeaders="True" /> |
</ClientSettings> |
<FilterMenu Skin="WebBlue"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</FilterMenu> |
</telerik:RadGrid> |
</telerik:RadPane> |
</telerik:RadSplitter> |
</asp:Content> |
#region Using... |
using System; |
using System.Collections; |
using System.Collections.Generic; |
using System.Configuration; |
using System.Data; |
using System.Linq; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.HtmlControls; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Xml.Linq; |
using MDe.Framework.Application; |
using MDe.Framework.Navigation; |
using MDe.Blender.AppServer.Application; |
using MDe.Blender.Lib.MessagingTypes; |
using MDe.BlenderWeb.AppCode.Pages; |
using Telerik.Web.UI; |
using MDe.Framework.Model.Admin.RefMds; |
using MDe.Framework.FunctionSpecs; |
using MDe.BlenderWeb.AppCode.Caches; |
using MDe.Framework.Model.Contacts; |
using System.Collections.Specialized; |
#endregion |
public partial class DevTools_RefMDs : BlenderBasePage |
{ |
#region Properties |
/// <summary> |
/// Property gives access to the contact that is stored in the session. |
/// </summary> |
//public List<FunctionGroup> functionGroups |
//{ |
// get |
// { |
// if (Session["_functionGroups"] == null) |
// { |
// return GetFunctionGroups(); |
// } |
// else |
// { |
// return (List<FunctionGroup>)Session["_functionGroups"]; |
// } |
// } |
// set { Session["_functionGroups"] = value; } |
//} |
#endregion |
#region Page Load |
/// <summary> |
/// |
/// </summary> |
/// <param name="sender"></param> |
/// <param name="e"></param> |
protected void Page_Load(object sender, EventArgs e) |
{ |
int crud = -1; |
} |
#endregion |
#region Private Methods |
/// <summary> |
/// Get the FunctionGroups for use in the dropdownlist on the radgrid |
/// </summary> |
//private List<RefMD> GetRefMDs() |
//{ |
// Master.FunctionKeyName = FunctionKey; |
// this.SetFunction(FunctionKey.GET_FUNCTION_GROUPS); |
// ApplicationResult result = this.requestManager.ExecuteRequest(this.request); |
// return result.Data as List<FunctionGroup>; |
//} |
private void SetRefMds() |
{ |
Master.FunctionKeyName = FunctionKey.FIND_REF_MDS; |
this.SetFunction(FunctionKey.FIND_REF_MDS); |
RefMdSearchCriteria criteria = new RefMdSearchCriteria(); |
criteria.FirstName = this.txtFirst.Text; |
criteria.LastName = this.txtLast.Text; |
criteria.Npi = new Npi(this.txtNPI.Text); |
criteria.OrgId = userDetails.LoginResult.LastPracticeUsed; |
this.request.Parameters.Add("RefMdSearchCriteria", criteria); |
ApplicationResult result = this.requestManager.ExecuteRequest(this.request); |
List<RefMd> list = result.Data as List<RefMd>; |
this.rgRefMDs.DataSource = list; |
//this.rgRefMDs.DataBind(); |
} |
#endregion |
#region Protected Methods |
/// <summary> |
/// |
/// </summary> |
/// <param name="source"></param> |
/// <param name="e"></param> |
protected void rgRefMds_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
{ |
if (Page.IsPostBack) |
SetRefMds(); |
} |
/// <summary> |
/// |
/// </summary> |
/// <param name="sender"></param> |
/// <param name="e"></param> |
protected void rgRefMds_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditFormItem && e.Item.IsInEditMode) |
{ |
GridEditFormItem item = (GridEditFormItem)e.Item; |
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); |
DropDownList ddlState = userControl.FindControl("ucContact").FindControl("ddlState") as DropDownList; |
DropDownList ddlPhoneType1 = userControl.FindControl("ucContact").FindControl("ddlPhoneType1") as DropDownList; |
DropDownList ddlPhoneType2 = userControl.FindControl("ucContact").FindControl("ddlPhoneType2") as DropDownList; |
DropDownList ddlPhoneType3 = userControl.FindControl("ucContact").FindControl("ddlPhoneType3") as DropDownList; |
ddlState.DataSource = DataCache.Instance.States; |
ddlState.DataBind(); |
if (DataBinder.Eval(item.DataItem, "Contact.Address.StateCode") != null) |
{ |
ddlState.SelectedIndex = ddlState.Items.IndexOf(ddlState.Items.FindByValue(DataBinder.Eval(item.DataItem, "Contact.Address.StateCode").ToString())); |
} |
ddlPhoneType1.DataSource = DataCache.Instance.PhoneTypes; |
ddlPhoneType1.DataBind(); |
if (DataBinder.Eval(item.DataItem, "Contact.PhoneNumber.TypeId") != null) |
{ |
ddlPhoneType1.SelectedIndex = ddlPhoneType1.Items.IndexOf(ddlPhoneType1.Items.FindByValue(DataBinder.Eval(item.DataItem, "Contact.PhoneNumber.TypeId").ToString())); |
} |
ddlPhoneType2.DataSource = DataCache.Instance.PhoneTypes; |
ddlPhoneType2.DataBind(); |
if (DataBinder.Eval(item.DataItem, "Contact.AlternatePhoneNumber.TypeId") != null) |
{ |
ddlPhoneType2.SelectedIndex = ddlPhoneType2.Items.IndexOf(ddlPhoneType2.Items.FindByValue(DataBinder.Eval(item.DataItem, "Contact.AlternatePhoneNumber.TypeId").ToString())); |
} |
ddlPhoneType3.DataSource = DataCache.Instance.PhoneTypes; |
ddlPhoneType3.DataBind(); |
if (DataBinder.Eval(item.DataItem, "Contact.Phone3.TypeId") != null) |
{ |
ddlPhoneType3.SelectedIndex = ddlPhoneType3.Items.IndexOf(ddlPhoneType3.Items.FindByValue(DataBinder.Eval(item.DataItem, "Contact.Phone3.TypeId").ToString())); |
} |
} |
} |
#endregion |
protected void lnkSearch_Click(object sender, EventArgs e) |
{ |
SetRefMds(); |
} |
protected void lnkReset_Click(object sender, EventArgs e) |
{ |
this.txtFirst.Text = null; |
this.txtLast.Text = null; |
this.txtNPI.Text = null; |
this.rgRefMDs.DataSource = null; |
this.rgRefMDs.DataBind(); |
} |
private void UpdateRefMD(RefMd rmd, GridEditableItem editedItem) |
{ |
UserControl userControl = (UserControl)editedItem.FindControl(GridEditFormItem.EditFormUserControlID); |
//Access the textbox from the edit form template and store the values in string variables. |
rmd.Npi = new Npi((userControl.FindControl("txtNPI") as TextBox).Text); |
rmd.FirstName = (userControl.FindControl("txtFirstName") as TextBox).Text; |
rmd.MiddleName = (userControl.FindControl("txtMiddleName") as TextBox).Text; |
rmd.LastName = (userControl.FindControl("txtLastName") as TextBox).Text; |
rmd.IsActive = (userControl.FindControl("chkIsActive") as CheckBox).Checked; |
rmd.OrgId = userDetails.LoginResult.LastPracticeUsed; |
Contact contact = new Contact(); |
rmd.Contact = contact; |
rmd.Contact.ContactId = int.Parse((userControl.FindControl("ucContact").FindControl("txtContactId") as TextBox).Text); |
rmd.Contact.Address.Line1 = (userControl.FindControl("ucContact").FindControl("txtAddressLine1") as TextBox).Text; |
rmd.Contact.Address.Line2 = (userControl.FindControl("ucContact").FindControl("txtAddressLine2") as TextBox).Text; |
rmd.Contact.Address.Line3 = (userControl.FindControl("ucContact").FindControl("txtAddressLine3") as TextBox).Text; |
rmd.Contact.Address.City = (userControl.FindControl("ucContact").FindControl("txtCity") as TextBox).Text; |
rmd.Contact.Address.StateCode = (userControl.FindControl("ucContact").FindControl("ddlState") as DropDownList).SelectedValue; |
rmd.Contact.Address.Zip = (userControl.FindControl("ucContact").FindControl("txtZip") as TextBox).Text; |
rmd.Contact.PhoneNumber.Number = (userControl.FindControl("ucContact").FindControl("txtPhoneNumber") as TextBox).Text; |
rmd.Contact.PhoneNumber.TypeId = int.Parse((userControl.FindControl("ucContact").FindControl("ddlPhoneType1") as DropDownList).SelectedValue); |
rmd.Contact.AlternatePhoneNumber.Number = (userControl.FindControl("ucContact").FindControl("txtAlternatePhoneNumber") as TextBox).Text; |
rmd.Contact.AlternatePhoneNumber.TypeId = int.Parse((userControl.FindControl("ucContact").FindControl("ddlPhoneType2") as DropDownList).SelectedValue); |
rmd.Contact.Phone3.Number = (userControl.FindControl("ucContact").FindControl("txtPhone3") as TextBox).Text; |
rmd.Contact.Phone3.TypeId = int.Parse((userControl.FindControl("ucContact").FindControl("ddlPhoneType3") as DropDownList).SelectedValue); |
rmd.Contact.Address.Zip = (userControl.FindControl("ucContact").FindControl("txtZip") as TextBox).Text; |
Master.FunctionKeyName = FunctionKey.SAVE_REF_MD; |
this.SetFunction(FunctionKey.SAVE_REF_MD); |
this.request.Parameters.Add("RefMd", rmd); |
ApplicationResult result = this.requestManager.ExecuteRequest(this.request); |
if (result.Success) |
{ |
//this.Master.SetMessage(this.GetSystemString("FunctionSpec Saved"), |
//MessagingTypes.MESSAGE_TYPE_INFO); |
} |
else |
{ |
this.Master.SetMessage(result.Message, MessagingTypes.MESSAGE_TYPE_ERROR); |
} |
} |
/// <summary> |
/// |
/// </summary> |
/// <param name="source"></param> |
/// <param name="e"></param> |
protected void rgRefMds_UpdateCommand(object source, GridCommandEventArgs e) |
{ |
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); |
RefMd rmd = new RefMd(); |
//Get the GridEditableItem of the RadGrid |
GridEditableItem editedItem = e.Item as GridEditableItem; |
//Get the primary key value using the DataKeyValue. |
rmd.RefMdId = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["RefMdId"].ToString()); |
UpdateRefMD(rmd, editedItem); |
} |
protected void rgRefMDs_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked |
{ |
e.Canceled = true; |
//Prepare an IDictionary with the predefined values |
ListDictionary newValues = new ListDictionary(); |
Contact contact = new Contact(); |
newValues["contact"] = contact; |
//Insert the item and rebind |
e.Item.OwnerTableView.InsertItem(newValues); |
GridEditCommandColumn editColumn = (GridEditCommandColumn)rgRefMDs.MasterTableView.GetColumn("EditCommandColumn"); |
editColumn.Visible = true; |
} |
} |
protected void rgRefMDs_InsertCommand(object source, GridCommandEventArgs e) |
{ |
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); |
RefMd rmd = new RefMd(); |
//Get the GridEditableItem of the RadGrid |
GridEditableItem editedItem = e.Item as GridEditableItem; |
//Get the primary key value using the DataKeyValue. |
rmd.RefMdId = -1; |
UpdateRefMD(rmd, editedItem); |
} |
} |