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

some help in client events for grid

6 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thiago
Top achievements
Rank 1
Thiago asked on 11 Jul 2008, 01:18 AM

Hi!

I love u guys, i try and try...and learn and learn
but the more i learn, i discover that i dont know nothing...
HEheheh

First let me explain what am trying to do:

I have an RadGridView that have 6 columns
(Name,un,coef,cons,cust,Total).

and

I have an RadNumericTextBox out the grid.
 
I need that the column 'cons' have an label.text = (the out RadNumericTextBox value) * (the value of the specific
column 'coef')

and

I need that the column 'cust'(that have an RadNumericTextBox ) when changed the specif column 'Total' will be set to
'cons * cust'

and

When the Column 'Total' Blur, the column 'Cust' will be set to 'Total / Cons'

and in the footer i have an another RadNumericTextBox that have the sum of the column 'Total'

The image will explain better what i'm trying to do:


[URL=http://img507.imageshack.us/my.php?image=learnxp1.png][IMG]http://img507.imageshack.us/img507/415/learnxp1.th.png[/IMG][/URL]

http://img507.imageshack.us/my.php?image=learnxp1.png

now for the questions :P:

1)How to make to the column 'cons' modify in the client when the out RadNumericTextBox changed?
2)How to get the value of the column 'Cons' when the RadNumericTextBox of the column 'Cust' changed?

Thanks,

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Jul 2008, 06:21 AM
Hello Thiago,

Please check this example:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Controls/Examples/Integration/GridAndInput/DefaultCS.aspx?product=grid

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Princy
Top achievements
Rank 2
answered on 11 Jul 2008, 10:01 AM
Hello Thiago,

You can also try out the following code snippet.

ASPX:
 <Columns> 
            <telerik:GridBoundColumn DataField="Col1" UniqueName="Col1" HeaderText="Col1"
            </telerik:GridBoundColumn> 
             
            <telerik:GridTemplateColumn HeaderText="TempCol" UniqueName="TempCol"
            <ItemTemplate> 
            <asp:Label runat="server" ID="Label1" Text='<%#Eval("TempCol") %>' > 
            </asp:Label> 
            </ItemTemplate> 
            </telerik:GridTemplateColumn> 
 </Columns> 

<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged" AutoPostBack="True"></asp:TextBox> 

CS:
   protected void TextBox1_TextChanged(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            int Value1 = int.Parse(item["Col1"].Text); 
            int Value2 = int.Parse(TextBox1.Text); 
            int Product = Value1 * Value2; 
            string strProduct = Convert.ToString(Product); 
            Label lbl = (Label)item["TempCol"].FindControl("Label1"); 
            lbl.Text = strProduct
        } 
    } 

Thanks
Princy.

0
Thiago
Top achievements
Rank 1
answered on 11 Jul 2008, 02:13 PM
Hello Princy and Vlad ,

Princy, i need to do this without an post back, have any way to do this?

Vlad, i saw this example but he shows the sum of the total only, the others i try to do follow this but nothing :(... if u can give me some hand...


tks,



0
Thiago
Top achievements
Rank 1
answered on 11 Jul 2008, 06:32 PM
I get it!finally :P!

but i still need one more thing....that is the out radnumeric when blur need whitout an postback set for each cons label to coef * radnumeric...

if u have the logic for do this...please :P

tks,
0
Thiago
Top achievements
Rank 1
answered on 12 Jul 2008, 03:51 PM
I tryed this:

JS

var

Grid = null;

function

LoadMasterTable(sender, args)

{

Grid = sender;

}

source grid

<ClientSettings>

<ClientEvents onmastertableviewcreated="LoadMasterTable" />

</ClientSettings>

but when i try to take the specific row, for example i try to pick the first row with:


Grid.get_masterTableView().get_dataItems()[0] ---- this is an object but

Grid.get_masterTableView().get_dataItems()[0].getDataKeyValue(0)--- this is null

why?can anyone help?

tks :P

0
Vlad
Telerik team
answered on 14 Jul 2008, 04:43 AM
Hello Thiago,

Please check this example for more info:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Client/Keys/DefaultCS.aspx

Regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Thiago
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Princy
Top achievements
Rank 2
Thiago
Top achievements
Rank 1
Share this question
or