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

radGrid and AJAX enable

3 Answers 380 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 08 Jan 2009, 04:14 AM
I have a radGrid but there is no option to make it AJAX enabled (ie EnableAJAX is not allowed). Here is the snippet of the HTML

<

telerik:RadGrid ID="Grid_tblboqmaterial" runat="server" EnableAJAX="True"

 

 

AllowAutomaticInserts="True" DataSourceID="SqlDataSource2" GridLines="None" >

The bit in bold comes up with the error "Validation(ASP.NET): Attribute 'EnableAJAX' is not a valid attribute of element 'RadGrid' ".

I have added an AJAX manager and configured the grid to depend on itself and it would appear that AJAX is being used. In my case all I'm trying to do is multiply 2 columns of the active row in the grid and place the result in a 3rd column and with AJAX it is just as slow as doing a full postback. Clearly I am doing something wrong.
 
I tried to do the simple calculation in javascript but I cannot work out the syntax to get the values of the columns of the row I am on because both of the columns required are not the column being updated.

Does anybody know what might be the mistake here or can offer a solution that should be quick for this simple calculation?

Thanks in advance
Ben

 

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 09 Jan 2009, 02:53 PM
Hi Ben,

RadGrid for ASP.NET AJAX does not have built in ajax as RadGrid for ASP.NET. Now you can use RadAjax for instance to ajaxify your grid as explained here.

I suggest that you review the below articles for more information about RadGrid client-side API:

http://www.telerik.com/help/aspnet-ajax/grdgettingfamiliarwithclientapi.html
http://demos.telerik.com/aspnet-ajax/Grid/Examples/Client/ClientSideEvents/DefaultCS.aspx
http://www.telerik.com/help/aspnet-ajax/grid_onrowselected.html
http://www.telerik.com/help/aspnet-ajax/grid_getcellbycolumnuniquename.html
http://demos.telerik.com/aspnet-ajax/Grid/Examples/Client/Selecting/DefaultCS.aspx
http://demos.telerik.com/aspnet-ajax/Grid/Examples/Programming/SelectRowWithCheckBox/DefaultCS.aspx
http://demos.telerik.com/aspnet-ajax/Controls/Examples/Integration/GridAndInput/DefaultCS.aspx?product=grid

Additionally, you can send me the problematic page so I could try finding what could be wrong with it.

Let me know how it goes.

Greetings,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ben
Top achievements
Rank 1
answered on 14 Jan 2009, 07:11 AM
Iana,
Thanks very much for the response. It has helped me get a lot further to the result I am seeking. I was unaware that the most recent version of telerik:radGrid was different and that the Enable AJAX property had been removed.

I have a rather large grid and the response time using AJAX is not acceptable to the users, hence why I am trying to do some of the simple calculations in javascript. I have managed to write some functions that detect the row selected and also to get the values from the grid columns for that row, all in javascript.

For example

 

function CalcTotalPrice(sender, eventArgs)

 

{

alert(

"Got grid row");

 

alert(

"Row index = "+ giActiveRowIndex);

 

 

var boqgrid = $find("<%= Grid_tblboqmaterial.ClientID %>");

 

 

var MasterTable = boqgrid.get_masterTableView();

 

 

var sQty = MasterTable.get_dataItems()[giActiveRowIndex].get_cell("Quantity").getElementsByTagName('input')[0].getAttribute('value');

 

 

var sUnitRate = MasterTable.get_dataItems()[giActiveRowIndex].get_cell("UnitRate").innerText;

 

 

var dQty = parseFloat(sQty);

 

 

var dUnitRate = parseFloat(sUnitRate.substring(1,sUnitRate.length));

 

MasterTable.get_dataItems()[giActiveRowIndex].get_cell(

"TotalPrice").innerText = dQty * dUnitRate;

 

 

debugger;

 

}

where the giActiveRowIndex is a global javascript variable and is collected through the rowmouseover event and when a user clicks in any control within the row the onclick/onfocus event sets the index into the javascript variable. My problem now is when a user adds a new record to the grid. How can I get the column values for this newly inserted record? I gather that because it is a new record it is not part of the master table view and therefore the above code will not work. I've looked for quite some time through google and through these forums and the telerik help but am still at a loss as to how to get the values. Does a new record row (inserted row) have it's own javascript object and if so how do I retrieve this object and find the values within it.

This grid takes about 4 seconds to simply multiply the 2 columns if I use AJX but if I turn postback off and use javascript it is almost instantaneous.

This help http://www.telerik.com/help/aspnet-ajax/grdgettingfamiliarwithclientapi.html has a lot of methods etc about the grid but not really any examples telling me what each method returns and almost no examples.

Any help along these lines would be highly appreciated.

Thanks again for the earlier help.

Ben

0
Iana Tsolova
Telerik team
answered on 14 Jan 2009, 11:03 AM
Hi Ben,

I am afraid that there is no client-side methods for accessing RadGrid InsertEditForm. However you can try using an outside form for inserting new records for your puspose.

Review this code library fo more informatio on the suggested solution.

Sincerely yours,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Ben
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Ben
Top achievements
Rank 1
Share this question
or