Telerik Forums
UI for ASP.NET AJAX Forum
11 answers
1.1K+ views
Hello.

I need to delete all rows of a datagrid from client side. I have the following javascript code:

******************************************
            var masterTable = $find("<%=  RadGrid1.ClientID %>").get_masterTableView();

            var numRows = masterTable.get_dataItems().length;
            for (i = numRows-1; i >= 0 ; i--)
            {
                masterTable.deleteItem(masterTable.get_dataItems()[i].get_element());
            }

******************************************

In the begining it worked fine, but if I put the radgrid into an updatePanel, it only works for the first row to delete. With the second row, I get this error:

'this.get_element().tBodies' is null or is not an object

I need the radgrid into an update panel in order to perform another tasks server-side using Ajax.

Any idea? Is there another way to delete all rows in a radgrid client-side?

Thanks in advance.




Tsvetoslav
Telerik team
 answered on 21 Aug 2009
1 answer
96 views
Hi, I'm using RadGrid to show my data.
I programmatically assign the DataSource to the DataGrid
And I'm using almost only TemplateColumn.
And I'm using the EditFormTemplate to define the template for editing (because I need flexibility).
But now, the Grid is not entering in edit mode... I tried a lot of methods.. using CommandName = "Edit" or by using Item.Edit = true or using the EditIndexes Collection... but none of them worked...
Can you help me?
Here the Grid declaration:
<rad:RadGrid ID="articlesGrid" runat="server" AllowPaging="true" AllowSorting="false" 
    AutoGenerateColumns="false" AutoGenerateDeleteColumn="false" AutoGenerateEditColumn="false" 
    AllowAutomaticDeletes="True" AllowAutomaticInserts="True"  
    AllowAutomaticUpdates="True" onitemdatabound="articlesGrid_ItemDataBound"  
    onitemcommand="articlesGrid_ItemCommand"  
    onsortcommand="articlesGrid_SortCommand" oneditcommand="articlesGrid_EditCommand" 
    > 
    <MasterTableView NoMasterRecordsText="<%$ Resources:,NoData %>" PageSize="10" AllowPaging="true" AllowSorting="false"
        <Columns> 
            <rad:GridTemplateColumn UniqueName="id" ReadOnly="true" HeaderText="<%$ Resources:Grids,Articles_ID %>" SortExpression="id_article"
                <ItemTemplate> 
                    <asp:Label ID="labelID" runat="server" Text='<%# Eval("id_article") %>' /> 
                </ItemTemplate> 
            </rad:GridTemplateColumn> 
            <rad:GridTemplateColumn UniqueName="title" HeaderText="<%$ Resources:Grids,Articles_Title %>" SortExpression="title"
                <ItemTemplate> 
                    <asp:Label ID="labelTitle" runat="server" Text='<%# Eval("title") %>' /> 
                </ItemTemplate> 
            </rad:GridTemplateColumn> 
            <rad:GridButtonColumn UniqueName="edit" HeaderText="<%$ Resources:Labels,Edit %>" CommandName="Edit" Text="<%$ Resources:Labels,Edit %>" /> 
            <rad:GridButtonColumn UniqueName="delete" HeaderText="<%$ Resources:Labels,Delete %>" CommandName="Delete" Text="<%$ Resources:Labels,Delete %>" /> 
        <!--CONTINUES--> 
        </Columns> 
        <EditFormSettings EditFormType="Template"
            <FormTemplate> 
                <table> 
                    <tr align="right"
                        <td colspan="2"
                            <asp:ImageButton ID="buttonUpdate" runat="server" CommandName="Update" ToolTip="<%$ Resources:Labels,Update %>" ValidationGroup="editArticle" CausesValidation="true" /> 
                            <asp:ImageButton ID="buttonCancel" runat="server" CommandName="Cancel" ToolTip="<%$ Resources:Labels,Cancel %>" /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <asp:Label ID="Label1" runat="server" Text="<%$ Resources:,Author %>" AssociatedControlID="textBoxAuthor" /> 
                        </td> 
                        <td> 
                            <asp:TextBox ID="textBoxAuthor" runat="server" Text='<%# Bind("author") %>' MaxLength="80" Width="200px" /> 
                        </td> 
                    </tr> 
                <!--CONTINUES...--> 
                </table> 
            </FormTemplate> 
        </EditFormSettings> 
    </MasterTableView> 
</rad:RadGrid>
Thank you.
PS: I also tried to set the AllowAutomaticDeletes/Inserts/Updates to False but nothing..
hk proj
Top achievements
Rank 1
 answered on 21 Aug 2009
3 answers
176 views

How can all the filtered types and values from a grid view? In the grid view, we want to provide the flexibility to filter the result by more than one column. We are using custom data source to load the grid. The below URL helps to identify the last selected filter type and value (for example col.5).

http://www.telerik.com/help/aspnet-ajax/grdoperatewithfilterexpression.html

 

But I’m interested to know ALL the previously selected (for example Col 1, Col 2, and Col 3) filter type and value

 

 I’ve contacted the support and they have not given me the direct (appropriate) answer. Could any one help me?

Yavor
Telerik team
 answered on 21 Aug 2009
2 answers
119 views

I am having a problem with my RadGrid control.  It appears that the header line, one of the rows and some of the text is shifted all the way over to the right to the point where it's past the right border area.  How can I fix that?  See the link for a picture.  Thanks!

http://img198.imageshack.us/img198/6192/cssmessedup.jpg

Brett
Top achievements
Rank 1
 answered on 21 Aug 2009
1 answer
220 views
I have several columns in a instance of RadGrid using a DataFormatString to display currency with the decimal values removed (i.e. {0:c0}).

When a user attempts to filter on any of these columns using the "Equals" filter option, nothing is returned.  I presume this is because the underlying data contains the decimal values which is what RadGrid is filtering on.

Is there a recommended way of handling this scenario?
Veli
Telerik team
 answered on 21 Aug 2009
2 answers
118 views
Help...

I am trying to create a relatively simple (but generic) report page.
Eventually, it calls a stored procedure (defined dynamically) that may return one or more recordset(s).

For each recordset, I want to create a simple grid that I simply bind to my dataset.

The user specify one or more criteria and press a button, at which time I try to create my grid(s).

My code, called from within the Button Click method looks like this (phReport is a PlaceHolder control)
        public void BuildAGrid(SqlDataReader reader)  
        {  
            RadGrid grid = new RadGrid {DataSource = reader};  
            grid.EnableViewState = false;  
            grid.DataBind();  
 
            phReport.Controls.Add(grid);  
        }  

The Grid shows and contains the right columns BUT shows "No records to display".

Initially, I had left EnableViewState as default (true) for both the PlaceHolder and the dynamically created grid and it showed the records when pressing the button a second time (I suppose the rows were then coming from the ViewState somehow as it seemed to hold the data).

The various articles I found say to create the grid in the Page_Init event but mine need to respond to the button click...

Any idea what I am doing wrong, or what I should do?

Many Thanks


Eric
Eric
Top achievements
Rank 1
 answered on 21 Aug 2009
3 answers
114 views
I have a header control:


 
<HeaderTemplate> 
<asp:LinkButton runat="server" ID="lbSelectAllItems" Text="Select All" CommandName="SelectAllItems" CommandArgument="qualification" ></asp:LinkButton> 
</HeaderTemplate> 

I tried to add a javascript function in "OnClientClien" property to confirm action.

OnClientClick='return ConfirmSelectItem()'


when I click on the linkbutton at run time i get javascript error "object expected".

any idea what I am doing wrong?

thanks in advance
Princy
Top achievements
Rank 2
 answered on 21 Aug 2009
1 answer
185 views
Hi,
how to check kind of a control with jquery that this control is a RadComboBox or TextBox?
E.g.: I have a RadComboBox with id="Street" and I want to know if there is a RadComboBox.
Thanks.
Veselin Vasilev
Telerik team
 answered on 21 Aug 2009
2 answers
203 views

Hi,

i am using Q2 2009 skin , i wann to change to error message  font size.pls find the followin skin i am using

.RadWindow_RTBOlive .rwTopLeft,
.RadWindow_RTBOlive .rwTopRight,
.RadWindow_RTBOlive .rwTitlebar,
.RadWindow_RTBOlive .rwFooterLeft,
.RadWindow_RTBOlive .rwFooterRight,
.RadWindow_RTBOlive .rwFooterCenter,
.RadWindow_RTBOlive .rwTopResize,
.RadWindow_RTBOlive .rwStatusbar div,
.RadWindow_RTBOlive .rwStatusbar,
.RadWindow_RTBOlive .rwPopupButton,
.RadWindow_RTBOlive .rwPopupButton span,
.RadWindow_RTBOlive.rwMinimizedWindow .rwCorner,

{
    background-image: url('/PublishingImages/Window/WindowHorizontalSprites.gif'); 
    font-family:Arial, Helvetica, sans-serif !important;
 font-size:12px;

}

.RadWindow_RTBOlive .rwBodyLeft,
.RadWindow_RTBOlive .rwBodyRight,
.RadWindow_RTBOlive .rwStatusbarRow .rwCorner
{
 background-image: url('/PublishingImages/Window/WindowVerticalSprites.gif');
}

.RadWindow_RTBOlive .rwStatusbar input
{
    background-color: #f7f3e9;
  

}

.RadWindow_RTBOlive .rwControlButtons a
{
    background-image: url('/PublishingImages/Window/CommandButtonSprites.gif');
}

.RadWindow_RTBOlive a.rwIcon
{
 background-image: url('/PublishingImages/Window/WindowHorizontalSprites.gif');
}

div.RadWindow_RTBOlive .rwTitlebarControls em
{
 color: black;
}
div.RadWindow_RTBOlive .rwDialogInput
{
 border-top: solid 1px #556b2f;
 border-right: solid 1px #556b2f;
 border-bottom: solid 1px #556b2f;
 border-left: solid 1px #556b2f;
}

div.RadWindow_RTBOlive .rwDialogInput:hover
{
 border-top: solid 1px #556b2f;
 border-right: solid 1px #556b2f;
 border-bottom: solid 1px #556b2f;
 border-left: solid 1px #556b2f;
 color: #565656; 
}

div.RadWindow_RTBOlive td.rwLoading
{
    background-color: #fff;
}

.RadWindow_RTBOlive td.rwWindowContent
{
    background-color: #fff !important;
 }

/* Loading Indicators */

/* When ShowContentDuringLoad="true" */
.RadWindow_RTBOlive td.rwWindowContent.rwLoading
{
    background-image: url('/PublishingImages/Common/loading.gif');
}

/* When ShowContentDuringLoad="false" */
.RadWindow_RTBOlive input.rwLoading
{
    background-image: url('/PublishingImages/Common/loading_small.gif');
}

Thanks
Mala

Vittal
Top achievements
Rank 1
 answered on 21 Aug 2009
2 answers
224 views
Hi,

I was wondering if any one could help me. This is the setup:-
SQL Datasource:-
<asp:SqlDataSource ID="GridSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:connect %>" 
                        SelectCommand="FilterProcMainv2" SelectCommandType="StoredProcedure">  
                        <SelectParameters> 
                            <asp:Parameter Name="owner" Type="Int32" /> 
                            <asp:Parameter DefaultValue="7" Name="team" Type="Int32" /> 
                        </SelectParameters> 
                    </asp:SqlDataSource> 
 Part of the Grid:-
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="GridSqlDataSource" 
                        GridLines="None" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" 
                        PageSize="15" ShowGroupPanel="True">  
                        <MasterTableView DataSourceID="GridSqlDataSource" DataKeyNames="work_request_pk">  
                            <Columns> 
The grid has a number of filter columns dates and combo boxs with their own datasources. The grid loads with out any problems if I set it to  datasource with out any paremeters.

I've checked my sql and it works fine, I've debugged the stored procedure and its returning the results I want.

if anyone could help or point me in the right direction it would be a great help.

Thanks
Yavor
Telerik team
 answered on 21 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?