This question is locked. New answers and comments are not allowed.
Gerard Eikelboom
Top achievements
Rank 1
Gerard Eikelboom
asked on 17 Feb 2011, 01:41 PM
Hi,
To build the grid as we want to we use the onRowDataBound function.
This causes the grid to be very slowly.
So what you recommended us is to move all this and make use of clienttemplate.
I already move 50% of the code to the grid so, thanks for that.
But now I have another issue see the line below:
This line works fine. The picture is shown Enabled or disabled.
The only thing that is not correct is ShowBestelPopupBox(<#=BesteldAantal#>,<#=SteelPrijs#>, <#=AanregID#>)
The function is hit and SteelPrijs & AanregID are correct filled out.
BesteldAantal = 0 because this is not filled out.
This is a textbox before this column in the grid.
How can I retrieve this one at the moment i do the onclick?
Another question. Is it possible to for example onclick='test(RowIndex)'? Give the rowindex with the method using clienttemplate?
Regards,
Gerard
To build the grid as we want to we use the onRowDataBound function.
This causes the grid to be very slowly.
So what you recommended us is to move all this and make use of clienttemplate.
I already move 50% of the code to the grid so, thanks for that.
But now I have another issue see the line below:
.ClientTemplate("<#if(AanregID == 0){ #> <input type='button' disabled='true' value=' ' class='bestelbuttondisabled'/> <# }else { #> <input type='button' onclick='ShowBestelPopupBox(<#=BesteldAantal#>, <#=SteelPrijs#>, <#=AanregID#>)' value=' ' class='bestelbutton'/> <# } #>");The only thing that is not correct is ShowBestelPopupBox(<#=BesteldAantal#>,<#=SteelPrijs#>, <#=AanregID#>)
The function is hit and SteelPrijs & AanregID are correct filled out.
BesteldAantal = 0 because this is not filled out.
This is a textbox before this column in the grid.
How can I retrieve this one at the moment i do the onclick?
Another question. Is it possible to for example onclick='test(RowIndex)'? Give the rowindex with the method using clienttemplate?
Regards,
Gerard
6 Answers, 1 is accepted
0
Hello Gerard Eikelboom,
function ShowBestelPopupBox(button, SteelPrijs, AanregID)
{
var tr = $(button).closest("tr");
var textbox = tr.find(":text");
var BesteldAantal = textbox.val();
}
Regards,
Atanas Korchev
the Telerik team
The easiest way is to modify your ShowBestelPopupBox function to receive an instance of the button
onclick='ShowBestelPopupBox(this, <#=SteelPrijs#>, <#=AanregID#>)'
function ShowBestelPopupBox(button, SteelPrijs, AanregID)
{
var tr = $(button).closest("tr");
var textbox = tr.find(":text");
var BesteldAantal = textbox.val();
}
Regards,
Atanas Korchev
the Telerik team
0
Gerard Eikelboom
Top achievements
Rank 1
answered on 17 Feb 2011, 02:26 PM
Hi Atanas,
When I use your example I get an array of 200(grid size) in BesteldAantal returned
Here is my textbox where I fill out the number i want to order:
When I check for BesteldAantal [index].value it gives me the correct ordered number.
But then I need the index.
What is does it also shows an popup at onclick (javascript) And with rowindex I calculate where I have to set that popup. So if possible the row index would help me a lot.
Regards,
Gerard
When I use your example I get an array of 200(grid size) in BesteldAantal returned
Here is my textbox where I fill out the number i want to order:
.ClientTemplate("<input type='text' class='besteldaantal' name='BesteldAantal' onclick='ShowProductDetails(<#= artikelID #>)' />");When I check for BesteldAantal [index].value it gives me the correct ordered number.
But then I need the index.
What is does it also shows an popup at onclick (javascript) And with rowindex I calculate where I have to set that popup. So if possible the row index would help me a lot.
Regards,
Gerard
0
Hi Gerard Eikelboom,
the Telerik team
The row index can be retrieved like this:
function ShowBestelPopupBox(button, SteelPrijs, AanregID)
{
var tr = $(button).closest("tr");
var rowIndex = tr[0].rowIndex;
}
However I still think that my code should have worked. Is the "tr" the right one at all?
Regards,
the Telerik team
0
Gerard Eikelboom
Top achievements
Rank 1
answered on 17 Feb 2011, 03:23 PM
Atanas,
Here is my function what I have:
When I set a breakpoint rowIndex =undifined, textbox = undefined BesteldAantal =array(200)
So I don't know what goes wrong.
Also button is undefined when I try to read it.
Regards,
Gerard
Here is my function what I have:
function ShowBestelPopupBox(button, j, k) { var tr = $(button).closest("tr"); var rowIndex = tr[0].rowIndex; var textbox = tr.find(":text"); var BesteldAantal = textbox.val();So I don't know what goes wrong.
Also button is undefined when I try to read it.
Regards,
Gerard
0
Gerard Eikelboom
Top achievements
Rank 1
answered on 17 Feb 2011, 03:28 PM
Atanas,
I don't know but it works, just the way you said.
So the solution is correct. i don't now why but the values I receive are now the right ones. Herefore they where empty.
Thanks,
now i can finish and put the rest in the clienttemplates.
thanks again,
Gerard Eikelboom
I don't know but it works, just the way you said.
So the solution is correct. i don't now why but the values I receive are now the right ones. Herefore they where empty.
Thanks,
now i can finish and put the rest in the clienttemplates.
thanks again,
Gerard Eikelboom
0
Hi Gerard Eikelboom,
Atanas Korchev
the Telerik team
The problem is that "button" is undefined. Did you change the client template to pass the button? It should be like this.
<input type='button' onclick='ShowBestelPopupBox(this, <#=SteelPrijs#>, <#=AanregID#>)
Atanas Korchev
the Telerik team