Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am working in ASP.Net & c# project.
I have one Gridview which contains the Dropdownlist as one of its column and I have other text fields on the page which are like Master-Child relation.

I am binding data to gridview from code-behind cs file.
On row selection of the grid - the data should be filled in other fields on the page. For this purpose, i m adding one JavaScript function on gridview_rowdatabound event and passing those values in the function so that when row is selected - that function is called and other text fields are filled with corresponding data.
But at the same time, i have one text box which should be filled on selection of dropdownlist and for that i am calling client side function onchange of dropdownlist.

Now I m facing issue in this scenario:
Suppose i have txtDate, DropDwonName,GridRowSelected

1. when row is selected -GridRowSelected
function is called and fields including 'txtDate' are filled as per database values

2. when i select value from dropdownlist - it calls its onchange method and set the value of 'txtDate' field.

but at the same time,GridRowSelected function is also getting called which overlaps the value in 'txtDate' field(when its auto filled on selection of dropdown).

Can anyone help me in this case? Its very urgent.

Thanks & Regards,
anu
Posted
Updated 5-Jan-12 17:59pm
v2

a workaround is to maintain a flag to check in GridRowSelected function that whether textbox value is filled in through the dropdown change event or not. and in case value is set through dropdown event then don't override from gridrowselected event.
 
Share this answer
 
Hi skantg,

Thanks a lot.
Actually I was also trying to set Flag but due to overwork & stress, i was doing it in wrong way.
But today you showed me same direction & i completed it in 5 min.

Thanks a lot,
Anu
 
Share this answer
 
Comments
Mehdi Gholam 6-Jan-12 2:00am    
Use the comments, do not post solutions.

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