Hi,
I am displaying customer data [Id, Name and Address] in grid view. I also need to display some calculated value “Customer Points” in the grid. For the “Customer Points” I have added a GridViewTextBoxColumn “txtCustomerPoints” to the grid.
For displaying data in “txtCustomerPoints” i am using the CellFormatting Event as below:
private void RadGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
try
{
string columnUniqueName = ((GridViewDataColumn)e.CellElement.ColumnInfo).UniqueName;
if (columnUniqueName == "txtCustomerPoints " )
{
if (IsColumnExistsInGrid(RadGridView1.MasterGridViewTemplate, columnUniqueName))
{
RadGridView1.GridElement.BeginUpdate();
e.CellElement.RowInfo.Cells[columnUniqueName].Value = "Some Calculated Value";
RadGridView1.GridElement.EndUpdate();
}
}
}
catch (Exception ex)
{
throw ex;
}
}
But this generate an error on this line:
e.CellElement.RowInfo.Cells[columnUniqueName].Value = "Some Calculated Value";
The error is:
ex = {"Object reference not set to an instance of an object."}
StackTrace " at MSMainPrj.FormsEmbedded.Booking. RadGridView1_ValueChanging(Object sender, ValueChangingEventArgs e) in D:\\Users\\Yaqub.Ahmad\\CS2\\trunk\\code\\MSMainPrj\\FormsEmbedded\\Booking.cs:line 1755\r\n at Telerik.WinControls.UI.RadGridView.OnValueChanging(Object sender, ValueChangingEventArgs e)\r\n at Telerik.WinControls.UI.RadGridView.CallValueChanging(Object sender, ValueChangingEventArgs e)\r\n at Telerik.WinControls.UI.GridViewCellInfo.set_Value(Object value)\r\n at MSMainPrj.Libraries.TelerikGridHelper.SetGridColumnValue(RadGridView grid, CellFormattingEventArgs e, String columnName, Object value) in D:\\Users\\Yaqub.Ahmad\\CS2\\trunk\\code\\MSMainPrj\\Libraries\\TelerikGridHelper.cs:line 292" string
TargetSite {Void RadGridView1_ValueChanging(System.Object, Telerik.WinControls.UI.ValueChangingEventArgs)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
Kindly help me to update a custom column's value.
Thanks.
103 HostWindow window = dockMain.ActiveWindow as HostWindow;
104 Form form = window.Content.FindForm();
105 form.Close();
The form object is the correct form. There may be a reason why the form should not be closed and will set
the Cancel property to true; I can not find a way to detect this state. I really need to be able to cancel
a DockWindowClosing event based on the underlying form closing event.
How can I do this?
Thanks,
Mike
hai! I have use below code for ascx control page navigation depending upon ascx page name using panel bar...I need breadcrumb for ascx page navigation..can anyone findout some samples...
public string TrackedUserControl
{
get { return ViewState["TrackedUserControl"] as string; }
set { ViewState["TrackedUserControl"] = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostingFromMenu() && IsPostBack)
ReloadContent();
}
protected void PanelNavigation_PanelNavigationItemClick(object sender, RadPanelBarEventArgs e)
{
LoadContent(e.Item.Value);
}
private void LoadContent(string menuItemName)
{
string ucUrl = menuItemName + ".ascx";
UserControl uc = null;
try
{
uc =
this.LoadControl(ucUrl) as UserControl;
if (uc != null)
{
ContentPlaceholder.Controls.Add(uc);
TrackedUserControl = ucUrl;
}
}
catch (Exception ex)
{
string msg = ex.Message;
}
}
private void ReloadContent()
{
UserControl uc = null;
try
{
uc =
this.LoadControl(TrackedUserControl) as UserControl;
}
catch
{
}
if (uc != null)
ContentPlaceholder.Controls.Add(uc);
}
private bool IsPostingFromMenu()
{
string ctlPostingBack = ScriptManager.GetCurrent(this).AsyncPostBackSourceElementID;
Control c = this.FindControl(ctlPostingBack);
if (c == null)
return false;
return (c.ID == "PanelNavigation");
}
thx