What you want to see on DotNetFunda.com ?
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 43427 |  Welcome, Guest!   Register  Login
Home > Articles > ASP.NET AJAX > Multiplication of two textboxes in modal popup extender repeater control having repeater control without javascript

Multiplication of two textboxes in modal popup extender repeater control having repeater control without javascript

1 vote(s)
Rating: 3 out of 5
Article posted by Me_Himanshu on 6/6/2012 | Views: 3016 | Category: ASP.NET AJAX | Level: Beginner | Points: 250 red flag


I was developing an order from for my client.There was a 5 fields-:Customer name,Item,Quantity ordered,Rate of the item and total amount(i.e quantity* rate).The order is to be taken by admin of the website.
Earlier the requirement was that the admin will enter each item individually.
i.e if a single customer gives order of 10 items ,each item is to be inserted individually,and the total amount(rate * quantity) is to be multiplied and displayed in the page.That was quite easy and i have completed with simple function in javascript.But the trouble arised when user changed his requirement.Now the requirement was he want to enter multiple items for the same customer,and as soon as he click place order button,the data should be inserted in database.Everything was done,but i faced a bit trouble in multiplying the textboxes value in repeater.i crawled the google,but failed to find the worthful stuff.Finall i managed it.see how

Download


 Download source code for Multiplication of two textboxes in modal popup extender repeater control having repeater control without javascript


Introduction

Now here i will show you how to multiply two textboxes value and display in third that to in modal popup extender having repeater control

Using the code

<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="bound" OnItemCommand="Repeater1_ItemCommand">

<HeaderTemplate>

<table>

<tr>

<th>

Item

</th>

<th>

Qty Ordered

</th>

<th>

Rate

</th>

<th>

Amount

</th>

</tr>

</HeaderTemplate>

<ItemTemplate>

<tr>

<td>

<asp:TextBox ID="txtBookTitle" ValidationGroup="aa" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Item") %>'></asp:TextBox>

<asp:AutoCompleteExtender ID="AutoCompleteExtender2" EnableCaching="true" runat="server"

MinimumPrefixLength="1" CompletionSetCount="20" CompletionListHighlightedItemCssClass="AutoCompleteFlyoutHilightedItem"

CompletionListItemCssClass="AutoCompleteFlyoutItem" CompletionInterval="1000"

ServiceMethod="GetItemList" ServicePath="~/WebService2.asmx" TargetControlID="txtBookTitle">

</asp:AutoCompleteExtender>

</td>

<td>

<asp:TextBox ID="txtISBN" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Qty") %>'></asp:TextBox>

<asp:RequiredFieldValidator ID="reqqntyorder" runat="server" ValidationGroup="aa"

ErrorMessage="*" ControlToValidate="txtISBN"></asp:RequiredFieldValidator>

</td>

<td>

<asp:TextBox ID="txtrate" runat="server" OnTextChanged="multiply" AutoPostBack="true"

Text='<%#DataBinder.Eval(Container.DataItem,"Rate") %>'></asp:TextBox>

</td>

<td>

<asp:TextBox ID="txttotalprice" runat="server" Enabled="false" Font-Bold="true" Font-Size="Larger"

Text='<%#DataBinder.Eval(Container.DataItem,"TotalCost") %>'></asp:TextBox>

</td>

<td>

<asp:Button ID="btnAddAnother" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Button") %>'

CommandName='<%# DataBinder.Eval(Container.DataItem, "Button") %>' />

</td>

</tr>

</ItemTemplate>

<FooterTemplate>

</table>

</FooterTemplate>

</asp:Repeater>

dont forget to set autopostback propert of one of textbox to true


protected void multiply(object sender, EventArgs e)

{

foreach (RepeaterItem order in Repeater1.Items)

{

TextBox rate = order.FindControl("txtrate") as TextBox;

TextBox qnty = order.FindControl("txtISBN") as TextBox;

TextBox amt = order.FindControl("txttotalprice") as TextBox;

amt.Text = Convert.ToString((Convert.ToInt32(rate.Text)) * (Convert.ToInt32(qnty.Text)));

ModalPopupExtender1.Show();

}

}

Conclusion

That is how you can multipl two values in repeater control and display in another

Reference


In case of any problem please mail me to audacious.himanshu@gmail.com

If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

Experience:1 year(s)
Home page:not yet
Member since:Wednesday, June 06, 2012
Level:Starter
Status: [Member]
Biography:I am a avid user if this website since i started my career ,always fantasize to post some useful articles into it.I am having 1.5 years of experience in Asp.Net,C#,Sql server,JavaScript and just started m working on WCF and Linq.
>> Write Response - Respond to this post and get points
Related Posts

This article describes how to use ASP.NET AJAX PageMethods to submit data to the server and get response. It also shows how to serialize object into JSON format and access its properties in JavaScript.

Every Article I write is like a story. There are a lot of Companies that provide readymade controls that skinable and make out GUI (Graphical User interface) looks good. Spending time inventing a Wheel is not a Good idea. A lot of Developers or Development houses should look at Infragistics (www.Infragistics.com), ComponentArt and Telerik. There are more of them but these are Microsoft partners and they have made their mark in providing readymade Controls that you can use in your Visual Studio. But there are times where we don’t have a Budget and we been Controls like Date Picker. Well if you check the Visual Studio Toolbox, there is no Such Control.

This article demonstrates how to use newly launched AsyncFileUpload control of Ajax Control Toolkit.

Windows applications are more stable than web application. Even if the web is not that stable like a windows application, there are lot advantages of building Web Applications and one thing that we remember as ex-Windows programmers is that the Forms did not Flicker in front of the eyes of the user. This irritates a lot of users. Microsoft came back with a good solution for this problem and they introduced Ajax. In this Article am going to show you how you can create Flicker Free pages.

In this example i am populating gridview by creating Sqlconnection and SqlCommand, i've put a textbox for text to search in footer of gridview using footer template , and the search results are highlighted using regular expression, i m using AJAX for partial postback and update progress template to show search progress

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/23/2013 6:31:45 AM