Click here to Skip to main content
14,635,442 members
Rate this:
Please Sign up or sign in to vote.
I have dropdownlist with three values...
1.Monthly
2.Yearly
3.General

and an update panel where some design is made.
i want to use modalpopup when user select monthly or selected index=1

how to use target control id here.
please any body could suggest me .
Thank you
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

It's pretty simple.Use SelectedIndexChanged event of dropdownlist

Try this:
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { 
if (DropDownList1.SelectedItem.Text == "Monthly") 
{ 
ModalPopupExtender2.Enabled = true; 
ModalPopupExtender2.Show();//popup show
 } 
else 
{ 
ModalPopupExtender2.Enabled = false;
 ModalPopupExtender2.Hide();
 } 
}
   
v2
Comments
Md.Ashraf Ali 20-Mar-14 2:11am
   
Hi Jas....its fine but what i will write in target control id in Modalpopup?
Tom Marvolo Riddle 20-Mar-14 2:14am
   
Please wait... i'll check it & let you know
Md.Ashraf Ali 20-Mar-14 2:14am
   
when i click the dropdown modalpopup appears instead of selected item "monthly"
Md.Ashraf Ali 20-Mar-14 2:14am
   
<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" PopupControlID="PanelMonthly"
TargetControlID="ddlfeegroup">
Tom Marvolo Riddle 20-Mar-14 2:16am
   
Does it not working?
Md.Ashraf Ali 20-Mar-14 2:20am
   
when i click the dropdown popup appears but my desire is when i click the item "monthly" it should appear.
Tom Marvolo Riddle 20-Mar-14 2:23am
   
Please wait... i'll check it & let you know
Md.Ashraf Ali 20-Mar-14 2:26am
   
ok
Tom Marvolo Riddle 20-Mar-14 2:32am
   
hi buddy i found a simple solution. Include enabled ="false".try this:

<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" Enabled="false" PopupControlID="PanelMonthly" TargetControlID="ddlfeegroup">

and in.cs

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedItem.Text == "Monthly")
{
ModalPopupExtender2.Enabled = true;
ModalPopupExtender2.Show();//popup show
}
else
{
ModalPopupExtender2.Enabled = false;
ModalPopupExtender2.Hide();
}
}
on close button event again make ModalPopupExtender2.Enabled = false; or onclienclick of close button disable it
Tom Marvolo Riddle 20-Mar-14 2:33am
   
I tried at my end it's working
Md.Ashraf Ali 20-Mar-14 2:45am
   
Thank you Jas..its working but now little different problem occurs.When i click OK button its still showing the popup....and not returning the values that a choosen.....
Tom Marvolo Riddle 20-Mar-14 2:48am
   
sorry dude, i didn't get it.will you explain bit more?
Md.Ashraf Ali 20-Mar-14 2:53am
   
In my panel having checkbox values and a Ok button...when i check the checkbox values it should return the checked values on click of ok button but nothing get returns.
Tom Marvolo Riddle 20-Mar-14 2:59am
   
Dude,without seeing the code it's impossible to find what's wrong .The comment section doesn't show the code correctly so post it as a separate question with relevant code snippet.
Md.Ashraf Ali 20-Mar-14 3:09am
   
ok bro.....thanx for your solutions.....
Tom Marvolo Riddle 20-Mar-14 3:17am
   
welcome brother!

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100