• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

How do I make a drop down list visible and invisible in a grid, based on the selected value of another drop doWn list -PLEASE READ THE WHOLE QUESTION

I have a grid view consisting of about 7 columns namely, treatment reason, treatment id, status code , letter code , etc Treatment reason , treatment id, status code, letter code have drop down lists.treatment id drop down list populated by the values from a table and contains values such as 1, 2, 3.

when treatment id "1" is selected, a value from the status code drop down list must be selected ,
otherwise, the drop down list needs  to be hidden from the user, when adding a row or updating a row.
or the user should not be able to select any status code when treatment id is not "1".

Can anyone help me accomplish this ASAP USING ASP.NET AND C#2.0

It's very urgent. If i can get the logic/ code , that'll be grrreat.

I have one more question.
I have a table which ha sthe following columns
Treatment reason id pk, fk, not null
treatment id,pk, fk, not null
status code,pk, fk, not null
letter code fk not null
ttp null

treatment reason id, treatment id , status code constitute composite primary key.
as mentioned above, the user must select a status code only when the treatment id is "1", otherwise,
status code should be stored as an empty string in the sql server table.

I'm not able to arrive at the solution as status code is part of the composite primary key for the table and
it cannot be null.

Please help me accomplish this as it's extremely urgent.
I need it by tomorrow morning.If I can get the logic/ code , that'll be grreat!

  • 2
2 Solutions
Jai STech ArchCommented:
in the SELECTEDITEM CHANGED even of the treatment ID
write code to select the status code ...(enable / make visible the STATU CODE field)
this event will be fired even when you are adding a row...so thts to it... for the first question
Jai STech ArchCommented:
you should not have COMPOSITE PRIMARY KEY columns that will hold the value as NULL...so wht if you want to...instead of storing NULL(which you cannot)...store a default value like "0"(incase it is INT) or "NA" (if its a varchar)...
but you have to make sure the COMPOSITE PK contraint applies for it...otherwise error will thrown as DUPLICATE primary key constraint violation

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now