This is a migrated thread and some comments may be shown as answers.

Radgrid - remove empty white row when no records, and remove thick line at bottom of "insert" row.

2 Answers 417 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Bijal
Top achievements
Rank 1
Bijal asked on 17 Apr 2014, 05:07 PM

I'm trying to do a couple of things (picture attached):
1. Remove the empty white row that shows up when there are no records. How can I get rid of it?
2. Right below the textbox to insert a new item, there is a double line. Like the border is thicker. How can I remove the thicker border and just have a normal border at the bottom?

Here's my code:

<telerik:RadGrid ID="rgImpacts" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="True" AllowSorting="True" CellSpacing="0" DataSourceID="odsImpacts" GridLines="None" Width="800px" AutoGenerateColumns="False" OnInsertCommand="rgImpacts_InsertCommand">
    <AlternatingItemStyle BackColor="White" />
    <MasterTableView CommandItemDisplay="None" DataKeyNames="idImpactId" DataSourceID="odsImpacts" EditMode="InPlace" InsertItemDisplay="Bottom" ShowHeader="False">
        <Columns>
            <telerik:GridTemplateColumn DataField="varcharImpact" FilterControlAltText="Filter varcharImpact column" HeaderText="Impact" SortExpression="varcharImpact" UniqueName="varcharImpact">
                <EditItemTemplate>
                    <telerik:RadTextBox ID="txtImpact" runat="server" Text='<%# Bind("varcharImpact") %>' MaxLength="100" Width="600px" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblImpact" runat="server" Text='<%# Eval("varcharImpact") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Width="650px"></HeaderStyle>
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn FilterControlAltText="Filter EditCommandColumn column" Groupable="False" UniqueName="EditCommandColumn">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CssClass="gridLink" CommandName="Update" Text="Update" /> 
                    <asp:LinkButton ID="LinkButton2" runat="server" CssClass="gridLink" CausesValidation="false" CommandName="Cancel" Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton4" runat="server" CssClass="gridLink" CausesValidation="false" CommandName="Edit" Text="Edit" /> 
                    <asp:LinkButton ID="LinkButton3" runat="server" CssClass="gridLink" CausesValidation="false" CommandName="Delete" Text="Delete" />
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:LinkButton ID="LinkButton5" runat="server" CssClass="gridLink" CommandName="PerformInsert" Text="Insert" />
                </InsertItemTemplate>
                <HeaderStyle Width="100px"></HeaderStyle>
            </telerik:GridTemplateColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="ImageButton"></EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>


public partial class ChangeRequestForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rgImpacts.MasterTableView.NoMasterRecordsText = string.Empty;
                rgImpacts.MasterTableView.NoDetailRecordsText = string.Empty;
                rgImpacts.MasterTableView.IsItemInserted = true;
                rgImpacts.Rebind();
            }
        }
 
        protected void rgImpacts_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item = e.Item as GridDataItem;
            if (item != null)
            {
                var varcharImpact = ((RadTextBox) item.FindControl("txtImpact")).Text;
                DataAccessLayer.Impacts.ImpactsInsert(varcharImpact);
                rgImpacts.Rebind();
                e.Canceled = true;
            }
        }
 
    }



2 Answers, 1 is accepted

Sort by
0
Venelin
Telerik team
answered on 22 Apr 2014, 10:50 AM
Hello Bijal,

Your question have been answered in the support ticket with ID 811902. Please continue the conversation there.

Thank you.

Regards,
Venelin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Bala
Top achievements
Rank 1
answered on 23 May 2017, 06:37 AM

Hi team,

Telerik rad grid automatically inserts a blank row if i delete some record on the other grid.Please find the screen shot.

 

Tags
Ajax
Asked by
Bijal
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Bala
Top achievements
Rank 1
Share this question
or