Telerik Forums
UI for ASP.NET AJAX Forum
12 answers
493 views
I've been having real problems using the client side api of RadGrid. It seems to me to be incomplete / buggy / difficult to use (or i'm a bit dumb - very likely the case). Would be interesting to know if i'm doing this all wrong or if I have indeed wasted all those hours due to bugs....

A bit of background.... I've been using WCF services to supply data to some RadGrids which are contained within web parts. To use the in built data binding in Telerik 2009.01, you need to create an "Ajax WCF Service" as it doesn't work with normal "WCF services". Not a problem, except that I couldn't get this working unless I had integrated windows authentication turned on (which isn't an option as I will be running in a DMZ). This, I will put down to my lack of knowledge with WCF... so I ended up having to use a normal WCF service and manually data bind using Javascript.

Here are my issues:
1.  To data bind on the client side, you need to call dataBind() on the master table view. The problem with this is that if the grid hasn't been previously data bound on the server, there is no master table view generated on the client. So, calling get_masterTableView() returns null. Hence, you can't data bind on the client side since the object which does the data binding isn't there. To get around this I implemented the NeedsDataSource event on the server and assigned it an empty list - this was enough to provide a master table view on the client side, and so allow me to data bind. It just seems a bit stupid that the thing which allows you to data bind isn't actually available by default.

2.  Next problem... after data binding on the client side, there were no rows generated and I was getting lots of exceptions. I managed to get around this by populating the grid with enough rows of dummy data in the NeedsDataSource event on the server, then clearing this as soon as it reaches the client and calling dataBind(). Why would dataBind() on the client not generate the rows for me automatically? It seems that the rows need to be there in advance which seems a bit stupid, especially for the case where you don't know how many rows you will need.

3.  Nested rows: There is no support on the client side for nested rows. I have previously raised this so won't ramble on but just thought to mention it as another thing that is missing.

4.  There is also a problem where if a nested row is expanded and dataBind() is called, the expanded nested row remains visible after the data bind. So you end up with your new data, plus the old expanded nested row.

5.  No records template: If this is visible, after data binding on the client side the no records template remains visible even if the grid contains data.

I've finally got everything working as I want, but I have lost weeks of dev time working around these issues. It might have been easier if the documentation was of any use. E.g. search for get_masterTableView returns a 1 line statement that it gets an object of type MasterTableView, but then there is no documentation on how to use this object on the client side. Again... it's possible that I just didn't find the documentation, even though i've spent a lot of time searching - if this is the case then the documentation needs to be indexed better.

Sorry to ramble on but my frustration levels are high!
Rajshree
Top achievements
Rank 1
 answered on 04 Aug 2015
9 answers
289 views
I have a GridButtonColumn of type ImageButton with CommandName set to Delete. The column also has ConfirmDialogType set to RadWindow. I click the button in the grid cell and the RadWindow comes up asking if I want to delete the item. However, the user has no idea which item has been selected since it is not in a selected state. The user simply just click the delete button. How do I select the row before the confirm window comes up?
Josef Rogovsky
Top achievements
Rank 2
 answered on 03 Aug 2015
10 answers
890 views
Hi Team,
I have a RadWinows popup that i open on Clianient side using radOpen(). The problem i'm having is that in IE7 when the popup opens it doesn't refresh the page. I have a popup rad window with controls on on it and two buttons Save and Cancel. If i open the popup then edit the controls on the popup window and click cancel. When I open the popup again i see that the controls on the popup still have the same values in it even though i pressed cancel in IE8 this problem isn't hapenning. So that for IE7 I had to use the RelodOnShow proprty in the RadWindowManager to refersh the popup on load. But this is making the load of the popup very very slow. Is there away i can refresh the rad window who or make it work properly in IE7. 
Thanks
Nasiem
Vessy
Telerik team
 answered on 03 Aug 2015
1 answer
183 views

From your demo http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipzoneid/defaultvb.aspx

 

 

  <div class="demo-containers" id="container1">
        <div class="demo-container">
            <h2>
                Tooltipified links in the "container1" zone
            </h2>
            <telerik:RadToolTipManager runat="server" AutoTooltipify="true" ID="RadToolTipManager1"
                ToolTipZoneID="zone1" RelativeTo="Element" Width="150px">
            </telerik:RadToolTipManager>
            <div id="module">
                Lorem ipsum dolor sit amet,

 

In the code there is no element defined as "zone1". What is the user there, I don't understand.

I want to tooltiptify a radslider but cannot succeed in this.

Marc

Ianko
Telerik team
 answered on 03 Aug 2015
1 answer
63 views

From 2 monts ago i´ve developing with this framework or suite package telerik, while i was program some aspx pages i founded some stop times for get or mapping the radcontrols from javascript file my great reason for write this post !! 
for mapping a control on our javascript we have put the next propertie ClientIDMode="Static" like

<telerik:RadTimePicker ClientIDMode="Static" DateInput-DateFormat="HH:mm:ss" Style="position:absolute; top:220px; left:500px" ID="_dtpMonthlyHour"  runat="server">
  </telerik:RadTimePicker>

and our javascript file mike this //.
var _dtpMonthlyHour=$telerik.findDatePicker("_dtpMonthlyHour");
with this line of code we can get all we want about this radControl !!

Vessy
Telerik team
 answered on 03 Aug 2015
1 answer
134 views

From 2 monts ago i´ve developing with this framework or suite package telerik, while i was program some aspx pages i founded some stop times for get or mapping the radcontrols from javascript file my great reason for write this post !! 

for mapping a control on our javascript we have put the next propertie ClientMode="Static" like

<telerik:RadTimePicker ClientIDMode="Static" DateInput-DateFormat="HH:mm:ss" Style="position:absolute; top:220px; left:500px" ID="_dtpMonthlyHour"  runat="server">
  </telerik:RadTimePicker>

 

and our javascript file mike this //.

var _dtpMonthlyHour=$telerik.findDatePicker("_dtpMonthlyHour");

with this line of code we can get all we want about this radControl !!

Vessy
Telerik team
 answered on 03 Aug 2015
2 answers
81 views

Scenario:

1. Change Editor to the "HTML" mode.

2. Paste the following text:

<span class="button primary">
<span style="color: red">
test
</span>
</span>

3. Change to the "Design" mode.

4. Change to the "HTML" mode.

Actual Result:

<span class="button primary" style="color: red;">
test
</span>

 

Two <span> tags merged into the one. Is it expected?​

Denis
Top achievements
Rank 1
 answered on 03 Aug 2015
8 answers
592 views
Hi everyone,

Sorry if such question has already been asked, but i cant find a topic that helps me completely.

First of all, Im using a RadGrid with most of the grid functions (Sorting, Paging, Grouping and Filtering). Im populating my grid with data coming from my database (as a ObservableCollection<Class>) through the page's code-behind, columns are auto-generated (nothing special so far). Note that my grid's EnableViewState="False".

The first problem i encountered was i had to use the OnNeedDataSource property (which i added), otherwise i was losing my grid data content when using the sorting and such. I then noticed that OnNeedDataSource was always requesting my database so I created a ViewState variable that will contain my collection variable in order to save those database round-trips (for each sorting, page change, etc.). The approach i chose was to only create a ViewState on the first grid function (ex: first time we do a sort). The reason is because most of my users wont do grid functions at all (so for those users, Viewstate wont be used at all). I accomplished this by adding some handlers (OnItemCommand, OnGroupsChanging) that create the ViewState if it doesnt exist already (OnNeedDataSource checks also for it).

Everything seemed to work as expected until i noticed that one grid function seemed to be failing at random occasion: playing with the expendable/foldable rows (when header(s) are grouped). The only way i could fix this was by adding the EnableViewState="True" to the grid, but now i end up with 2 ViewState per grid...which i dont really like.

My questions:
1-Is it normal that I depend on the EnableViewState="True" for expendable/foldable rows (where all other functions work with my "custom" Viewstate?)
2-Can that second "auto-generated" Viewstate (EnableViewState="True") be used to do the job of the first one? If yes, how can we access it?
3-Is there a way to force the OnItemCommand and OnGroupsChanging handlers to be fired before OnNeedDataSource? Having this would save me a round-trip.
4-Do you propose a better way to save the database round-trips?
5-I was wondering if it is a best practice to manually clear Viewstate variable that we create ourselves (when page quits/redirect)? If yes, any example?
6-Do you think letting the grid asking the database everytime would be less load on the server than 2 Viewstates?

Here are snippets of my code i have so far:
<telerik:RadGrid ID="RadGrid1" runat="server" PageSize="5" Width="75%"
                AllowSorting="True" AllowFilteringByColumn="True"  AllowMultiRowSelection="True" AllowPaging="True"
                ShowGroupPanel="True" GridLines="None" AutoGenerateColumns="True" ShowFooter="True"
                OnItemCommand="testcomm" OnGroupsChanging="testgroup" OnColumnsReorder="testreorder"
                OnNeedDataSource="RadGrid1_NeedDataSource" 
                Skin="WebBlue" EnableViewState="True" >
                
                    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
 
                    <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                        <Resizing AllowColumnResize="true" />
                    </ClientSettings>
 
                    <GroupingSettings ShowUnGroupButton="true" />
 
                </telerik:RadGrid

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        ObservableCollection<PersonDTO> col = new ObservableCollection<PersonDTO>();
 
 
        if (ViewState["RadGrid1_DataSource"] != null)
        {
            col = (ObservableCollection<PersonDTO>)ViewState["RadGrid1_DataSource"];
      
        }
        else
        {
 
            col = GridDataSource2();
 
        }
 
        RadGrid1.DataSource = col;
 
    }
 
 private void LoadViewState()
    {
        ObservableCollection<PersonDTO> col = new ObservableCollection<PersonDTO>();
 
        if (ViewState["RadGrid1_DataSource"] == null)
        {
 
            // collection isn't in view state, so we need to load it from scratch.
            if (RadGrid1.DataSource == null)
            {
                col = GridDataSource2();
            }
            else
            {
                col = (ObservableCollection<PersonDTO>)RadGrid1.DataSource;
            }
 
            if (col != null)
            {
 
                ViewState.Add("RadGrid1_DataSource", col);
 
            }
        }
    }
 
    protected void testcomm(object o, Telerik.Web.UI.GridCommandEventArgs e)
    {
        LoadViewState();
    }
 
    protected void testreorder(object o, Telerik.Web.UI.GridColumnsReorderEventArgs e)
    {
        LoadViewState();
    }
 
    protected void testgroup(object o, Telerik.Web.UI.GridGroupsChangingEventArgs e)
    {
        LoadViewState();
    }


Thanks...and sorry btw for the long post but i wanted to make everything clear.
Angel Petrov
Telerik team
 answered on 03 Aug 2015
1 answer
91 views

I create string variable "onEditUser" to be filled with a cell value (Label) when "Edit" command is fired. It is assigned correctly when The Edit button is clicked but when OnItemCommand() is recalled to perform Update Command, the variable assignment is removed and onEditUser become null.

Is there any help why this occurs, and what is the solution? (I need to use this variable in another method)

public partial class EditUsers : System.Web.UI.Page
{
string onEditUser;
    public void GridItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.UpdateCommandName || e.CommandName == RadGrid.PerformInsertCommandName)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            RadComboBox userTypecombo = (RadComboBox)item.FindControl("UserTypeRadComboBox");
            string userType = userTypecombo.SelectedItem.Text;
            SqlDataSource1.InsertParameters["UserType"].DefaultValue = userType;
            SqlDataSource1.UpdateParameters["UserType"].DefaultValue = userType;
        }
        if (e.CommandName == RadGrid.EditCommandName)
        {
        GridItem item = e.Item;
        Label userNameLB = (Label)item.FindControl("UserNameLabel");
        onEditUser = userNameLB.Text;
        }
    }

Eyup
Telerik team
 answered on 03 Aug 2015
1 answer
111 views

Hi,

I am using the Advanced Template for my appointment and the form contains a buttons with command names of "Insert" and "Update". I can successfully trigger these events and everything works well as long as the user enters all valid information. The command event code behind contains a lot of server-side validation.

If the validation fails at any point, the validation displays the appropriate error messages on the screen as expected. However, the advanced form closes and the day view calendar reappears. Is is extremely annoying to my users as they have entered a lot of information. They then have to recreate the entire appointment all over again.

Is there a way to cancel the event so that the advanced for stays on the page? There does not seem to be an e.Cancel setting as there is in the FormCreating event and I have searched the forums as well as google in general without locating a solution.

Thanks

Plamen
Telerik team
 answered on 03 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?