runat="server" AutoGenerateColumns="False" DataSourceID="odsInvLines"
GridLines="None" OnItemDataBound="gridInvLines_
<ClientSettings >
<ClientEvents OnKeyPress="disableEnterKey" OnCommand="OnGridCommand" OnPopUpShowing="PopUpShowing" />
</ClientSettings>
<MasterTableView DataKeyNames="LINE_NUMBER" DataSourceID="odsInvLines" EditMode="PopUp" InsertItemDisplay="Top" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" CommandItemDisplay="Top" CommandItemSettings-
<Columns>
<telerik:GridEditCommandColumn ButtonType="LinkButton" InsertText="Save" UniqueName="EditButton">
<ItemStyle HorizontalAlign="Center" Width="30px" />
</telerik:GridEditCommandColum
</Columns>
<EditFormSettings EditColumn-UpdateText="Save" EditColumn-InsertText="Save" CaptionFormatString="Invoice Line Information" ColumnNumber="2">
<FormTableItemStyle Wrap="False" Width="100%"></FormTableItemSt
<FormCaptionStyle CssClass="EditFormHeader" Width="100%"></FormCaptionStyl
<FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White"
Width="100%" />
<FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px"
BackColor="White" />
<FormTableAlternatingItemStyle Wrap="False"></FormTableAltern
<PopUpSettings Modal="true" Width="600" />
</EditFormSettings>
</MasterTableView>
<ValidationSettings CommandsToValidate="
function
OnGridCommand(sender, eventArgs){
if(eventArgs.get_commandName() == "Edit" || eventArgs.get_commandName() == "InitInsert" )
{
if (!Page_ClientValidate()) return false;
}
}
//server event
protected void gridInvLines_ItemCommand(objec
{
switch (e.CommandName)
{
case RadGrid.InitInsertCommandName:
e.Canceled =
true;//this is for the Calendar Date control
System.Collections.
if(radBillPeriodStartDate.
newValues[
newValues[
e.Item.OwnerTableView.
default:
break;
}
}
<httpHandlers> <add path="Telerik.Web.UI.WebResource.axd"type="Telerik.Web.UI.WebResourceSession" verb="*" validate="false" /></httpHandlers> <handlers> <add name="Telerik_Web_UI_WebResource_axd" verb="*"preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd"type="Telerik.Web.UI.WebResourceSession" /></handlers>

| <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" |
| GridLines="None" onitemdatabound="RadGrid1_ItemDataBound"> |
| <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> |
| <Columns> |
| <telerik:GridTemplateColumn> |
| <FooterTemplate> |
| <telerik:RadComboBox ID="RadComboBox1" runat="server"> |
| <ItemTemplate> |
| <telerik:RadGrid ID="RadGrid2" runat="server"> |
| </telerik:RadGrid> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
| </FooterTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" |
| ConnectionString="<%$ ConnectionStrings:XConnectionString %>" |
| SelectCommand="SELECT [Name] FROM [Projects]"></asp:SqlDataSource> |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item is GridFooterItem) | |
| { | |
| GridFooterItem footer = (GridFooterItem)e.Item; | |
| RadComboBox combo = ((RadComboBox)footer.FindControl("RadComboBox1")); | |
RadGrid grid = ((RadGrid)combo.Items[0].FindControl("RadGrid2")); //result is null
|
|
| string r = "fF"; | |
| } | |
| } |
we use the below piece of code for exporting to excel from grid.But in the output, we face a empty row between the header and data rows in excel sheet.we don't want that empty row.
In one of the forums post they said to add this code RadGrid1.MasterTableView.AllowFilteringByColumn = false;
but still we dont have luck on that
void btnExcel_Click(object sender, ImageClickEventArgs e)
{
LRG RadGridToExport = this.Page.FindControl(RadGridIDToExport) as LRG;
if (RadGridToExport == null) return;
if (RadGridToExport.Items.Count > 0)
{
RadGridToExport.ExportSettings.ExportOnlyData =
true;
RadGridToExport.ExportSettings.IgnorePaging = chkAll.Checked;
RadGridToExport.ExportSettings.OpenInNewWindow =
true;
RadGridToExport.MasterTableView.ExportToExcel();
}
}