Click here to Skip to main content
14,691,731 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have an AJAX tab container, inside which on PersonDays tab I have two problems:
1:
As you can view from the below given image that the item value selected in the DDL for ResourceType is getting changed to the default/ 1st value of the DDL while the new row is being created after clicking on "Add" button.
(The DDL's items are not being fetched from a DB table).
How to fix the value on the item selected by the user before clicking on the "Add" button?

2:
How the value in the "TotalCost" column can be calculated automatically on the change of focus from "CostPerDay", that is "No.ofDaysXCostPerDay" ***without clicking on the "Add"*** button and simultaneously filled up in the textBox present below the GridView and in the textBox present on the "EstimatedCost" tab before addition of the new row?
(In my Current state of form it gets calculated/ filled only after I click on the "Add" button")

Screen shot
"You Can Find the Solution File with DB backup script HERE"
Posted
Updated 15-Jun-12 3:08am
v3

Please find the answer :

1. You can retain the status of DDL by using viewstates. or storing them in other session variables.

2. you can use Focus change event or selectedindexchanged event of dropdown list. in that event you can calculate and populate the new values in text box.
   
Comments
Ashishkumar Patel 18-Jun-12 2:24am
   
For prob. 1: I have already used the viewstate but it is not able to retrive the data when the New Row is being created in GridView inside Tabcontainer.
If you have any other idea then please do share with me.

Prob 2: solution achieved by an overriding function, because the onFocusChange event was not getting fired.
have you tried editable gridview ?

The rows with values will be displayed as normal rows(w/o ddl or textbox just the selection text from ddl) . Use can use a templated coloum for automatic calcuation.

What do you say?????
   
Comments
Ashishkumar Patel 18-Jun-12 8:05am
   
Pls.. make some time to have a look into to the solution file I have attached.. then you will better understand my problem and can give some help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900