or
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
//Edits the text value of the column "Flow"
if
(dataItem[
"Flow"
].Text ==
"1"
)
{
dataItem[
"Flow"
].Text =
"Outcome"
;
}
if
(dataItem[
"Flow"
].Text ==
"2"
)
{
dataItem[
"Flow"
].Text =
"Income"
;
}
}
}
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
//Edits the text value of the column "Flow"
if
(dataItem[
"FlowReplica"
].Text ==
"1"
)
{
dataItem[
"Flow"
].Text =
"Outcome"
;
}
if
(dataItem[
"FlowReplica"
].Text ==
"2"
)
{
dataItem[
"Flow"
].Text =
"Income"
;
}
}
}
if (eval(something).ToString() != "")
{
<
span
style
=
"font-weight: bold;"
>Something:</
span
><%# Eval("something") + "%>
}
Hello, I have 3 grids nested inside a main grid using the NestedViewTemplate. Everything works fine for binding and displaying the data. The problem is I want to use a CommandItemTemplate in the nested grid to popup another window for inserting new parts. I can make the window pop-up, I just can not get the primary key from the top level grid to go with it. I have tried all kinds of stuff, but I was hoping to do something like the snippet below to include the PlanID as an argument to my javascript function:
I am open to C# code behind to set the onclick attributes or javascript to dig around if necessary to get the PlanID from the parent grid or the nested grid, it exists in both. I have inserted sample markup below if that helps. Thanks! Tom (Sorry for the blue, I should have typed before using the format code block?) <telerik:RadGrid ID="gridJobPlans" runat="server" DataSourceID="objJobPlans" |
||||
GridLines="None" AllowFilteringByColumn="True" AllowSorting="True" | ||||
AutoGenerateColumns="False" | ||||
onupdatecommand="gridJobPlans_UpdateCommand" | ||||
> | ||||
<MasterTableView DataKeyNames="ID" | ||||
DataSourceID="obj1" CommandItemDisplay="TopAndBottom"> | ||||
<NestedViewTemplate> | ||||
<asp:Label ID="PlanID" runat="server" Text='<%# Eval("ID") %>' /> | ||||
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="1" | ||||
MultiPageID="MultiPageSelectedJobPlan"> | ||||
<Tabs> | ||||
<telerik:RadTab runat="server" Text="Documents" | ||||
PageViewID="SelectedJobPlanDocs"> | ||||
</telerik:RadTab> | ||||
</Tabs> | ||||
</telerik:RadTabStrip> | ||||
<telerik:RadMultiPage ID="MultiPageSelectedJobPlan" Runat="server" | ||||
Width="703px" SelectedIndex="2"> | ||||
<telerik:RadPageView ID="Parts" runat="server"> | ||||
<telerik:RadGrid ID="Grid" runat="server" | ||||
AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" | ||||
AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" | ||||
DataSourceID="objSelected2" GridLines="None" AllowAutomaticDeletes="true"> | ||||
<MasterTableView AutoGenerateColumns="False" DataKeyNames="ID, PlanID" | ||||
CommandItemDisplay="TopAndBottom"> | ||||
<Columns> | ||||
<telerik:GridBoundColumn DataField="ID" DataType="System.Int64" HeaderText="ID" | ||||
ReadOnly="True" SortExpression="ID" UniqueName="ID" Display="false"> | ||||
</telerik:GridBoundColumn> | ||||
<telerik:GridBoundColumn DataField="PlanID" DataType="System.Int64" | ||||
HeaderText="PlanID" SortExpression="PlanID" UniqueName="PlanID" Display="true"> | ||||
</telerik:GridBoundColumn> | ||||
</Columns> | ||||
<CommandItemTemplate> | ||||
<asp:Label ID="lblAddNewPart" Text="Add" runat="server"/> | ||||
<a href="#" onclick="return ShowAddPartForm('<%# Bind( "PlanID" ) %>');">Add New </a> | ||||
</CommandItemTemplate> | ||||
</MasterTableView> | ||||
</telerik:RadGrid> | ||||
</telerik:RadPageView> | ||||
</telerik:RadMultiPage> | ||||
</NestedViewTemplate> | ||||
</MasterTableView> | ||||
</telerik:RadGrid> | ||||
RadGrid GridReport = (RadGrid)GridPlaceHolder.FindControl("GridReport");
if (GridReport.MasterTableView.Columns.FindByUniqueNameSafe("ObjectName") != null)
{
GridReport.MasterTableView.Columns.FindByUniqueName("ObjectName").Visible = false;
GridReport.MasterTableView.Columns.FindByUniqueName("ObjectNameText").Visible = true;
}
//GridReport.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
GridReport.ExportSettings.Excel.Format = GridExcelExportFormat.Html;
GridReport.ExportSettings.IgnorePaging = true;
GridReport.ExportSettings.OpenInNewWindow = true;
GridReport.ExportSettings.ExportOnlyData = true;
if (cbExportAllPages.Checked == true)
GridReport.PageSize = GridReport.MasterTableView.VirtualItemCount;
GridReport.DataSource = reportResult(Session["sqlStr"].ToString());
GridReport.Rebind();
GridReport.MasterTableView.ExportToExcel();
RadNumericTextBox in a GridTemplateColumn.
The user can update the Quantity on the Order Detail grid and click the Save button to save the Order Detail. This Save button is displayed in the Order Detail NestedViewTemplate.