[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Call the TextChange event for a textbox inside a datagrid.

Posted on 2006-07-15
5
Medium Priority
?
1,861 Views
Last Modified: 2008-01-09
Hi,
I have a ASP.net 1.1 Webform that contains a datagrid , that contains 4 columns
Product--Qty--Price--Total

Each column has a textbox. The user will enter a value in the Product and the Qty and Price textbox. I want to call the TextChange event of the Qty and Price and textboxes whenever the text inside them changes.
In the called textchange event I want to calculate the expression Qty*Price and assign the result to the Total textbox in the datagrid.

How can I do this?

Note:The controls are in the Datagrid.
0
Comment
Question by:TetraSA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 336 total points
ID: 17114994
TextChange event occures only when user inputs text into textbox AND hits enter key. But this way page-post-back occures. If user moves focus to another control with a mouse or TAB key, TextChange event will occur only after next postback. And I think it is not what you want.
I think that the best choise here is javascript. You should assign javascript junction to a string variable and register this function with Page.RegisterStartupScript. Next, whenever you add textboxes to datagrid, you should add this function as textbox's onleave (I guess) attribute to appropriate textboxes.
One problem you'll meet here is textboxes' names (or IDs in javascript). Even if you assign unique names to textboxes in datagrid's template columns they are chaned during page render. This happens so to keep unique names in a whole datagrid.
But I think this can be solved.
Here is what I can suggest you from a ASP.NET side. Javasript is not my strong side so I can suggest you wait for someone to respond with answer how to build javascript function (or even more better solution) that I was talking about or post a pointer question in javascript TA.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 332 total points
ID: 17115722
You can define a DataColumn in the DataTable that has Qty * Price for the expression.

Bob
0
 
LVL 9

Assisted Solution

by:zaghaghi
zaghaghi earned 332 total points
ID: 17116554
i'm agree with Ramuncikas, it better than you use java script rather than postback and its problems
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question