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

Radgrid with checkbox and textbox

3 Answers 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tracey Kroll
Top achievements
Rank 1
Tracey Kroll asked on 04 Jun 2009, 04:13 PM
I have a radgrid in which each row has a checkbox and a radnumerictextbox. At the bottom of the radnumerictextbox column is a footer that displays the sum of the textboxes. When a user unchecks a checkbox I want to reduce the sum in the footer by the amount in the numerictextbox of the same row as the checkbox. Does anyone know how I can reference the footer and textbox via client side script?

My grid code is as follows:

<telerik:RadGrid ID="gvAmount" runat="server" GridLines="Both" BorderStyle="None" ShowFooter="true"

 

ShowHeader="true" CellPadding="0" AutoGenerateColumns="false" CssClass="SearchGrid" AllowSorting="true" >

 

 

<MasterTableView>

 

 

<RowIndicatorColumn>

 

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

 

</RowIndicatorColumn>

 

 

 

 

 

<ExpandCollapseColumn>

 

<HeaderStyle Width="20px" Font-Size="Medium"></HeaderStyle>

 

 

 

</ExpandCollapseColumn>

 

 

 

 

 

<Columns>

 

 

<telerik:GridTemplateColumn UniqueName="Include" HeaderText="Include?" >

 

<ItemStyle />

 

 

 

<ItemTemplate>

 

 

 

<asp:CheckBox ID="chkInclude" runat="server" Checked="true" />

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

<telerik:GridBoundColumn DataField="ID" HeaderText="ID"

UniqueName="ID" EmptyDataText="&nbsp;" ItemStyle-HorizontalAlign="Left" />

 

 

<telerik:GridBoundColumn DataField="Name" HeaderText="Name"

UniqueName="Name" EmptyDataText="&nbsp;" ItemStyle-HorizontalAlign="Left" />

 

 

 


<telerik:GridTemplateColumn UniqueName="CurrAmt" HeaderText="Current Amount">

 

<ItemStyle />

 

 

 

<ItemTemplate>

 

 

 

<telerik:RadNumericTextBox ID="txtCurrAmt" runat="server" Width="60px" Value="0" >

 

 

 

<ClientEvents OnBlur="Blur" OnFocus="Focus" />

 

 

 

</telerik:RadNumericTextBox>

 

 

 

</ItemTemplate>

 

 

 

<FooterTemplate>

 

 

<telerik:RadNumericTextBox ID="txtCurrTotal" runat="server" Type="Currency" ReadOnly="true">

 

 

 

<ClientEvents OnLoad="Load" />

 

 

 

</telerik:RadNumericTextBox>

 

 

 

</FooterTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

 

<PagerStyle Visible="false" />

 

</MasterTableView>

 

 

 

 

 

<ClientSettings>

 

<Selecting AllowRowSelect="True" />

 

 

 

 /ClientSettings>

 

 

 

 

 

<FilterMenu>

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

 

</FilterMenu>

 

 

 

</telerik:RadGrid>

 

 

 

 

 



Thanks in advance!
-Tracey

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 09 Jun 2009, 04:01 PM
Hello Tracey,

You can get access to the respective RadNumericTextBox client objects directly inside their client event handlers (as they are passed as a first argument in them) and utilize the set_value()/get_value() method from their client API.

Review the javascript code from this online demo for details:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandinput/defaultcs.aspx?product=grid

and modify/extend it to be in conjunction with your custom project schema.

Best regards
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Pams
Top achievements
Rank 1
answered on 02 Nov 2010, 07:25 PM
Hello,
My requirement is,That textbox column is used to enter percentages.
Lets think I have 4 rows. If I enter 3 textboxes then automatically last one should be 100 minus that sum.
It should be automatically corrected.
Any help pls.
Thank u
0
Tsvetina
Telerik team
answered on 05 Nov 2010, 02:46 PM
Hello Pams,

Have you checked out the demo my colleague linked to? The only difference from what you describe is that the Type property in your case should be Percent and you should change the subtraction logic from the client-side methods. Otherwise, the textboxes in the demo do the same thing which you describe.

Greetings,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Tracey Kroll
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Pams
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or