Click here to Skip to main content
15,905,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have modalpopup by using ajax

in modalpopup i have one dropdownlist. i click button modalpopup is open.

i select dropdownlist option, event does not fired and page is refresh . again i click the option after that dropdown event fired.
Posted
Comments
Er. Vikas Sangal 3-Dec-12 5:16am    
pls. post ur code
kumar2233 3-Dec-12 5:34am    
<cc:modalpopupextender id="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground"
targetcontrolid="btnSubject" popupcontrolid="Panel1" drag="true" CancelControlID="lnkClose" >


Protected Sub btnSubject_Click(sender As Object, e As System.EventArgs) Handles btnSubject.Click
Try

ModalPopupExtender1.Show()
ModalPopupExtender1.Enabled = True

Catch ex As Exception
booError = True
Dim ErrContext As HttpContext = HttpContext.Current
ErrContext.Items.Add("ErrDesc", ex.Message)
ErrContext.Items.Add("ErrSrc", ex.Source)
ErrContext.Items.Add("ErrInfo", ex.StackTrace)
ErrContext.Items.Add("ErrFile", "D")
Finally
'If Not ddlIHNO Is Nothing Then ddlIHNO.Dispose()
'ddlIHNO = Nothing

'If Not ds Is Nothing Then ds.Dispose()
'ds = Nothing

End Try
If booError Then Response.Redirect("ErrorMessage.aspx", False)

End Sub


Protected Sub ddlDesc_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddldesc.SelectedIndexChanged


Try
ModalPopupExtender1.Show()
ModalPopupExtender1.Enabled = True

Dim objDetails As New Service
Dim dsdesc As New DataSet
dsdesc = objDetails.TaskMF_NCT_getSubjects(strApplid, strApplpwd, ddldesc.SelectedValue)
ddlSubject.DataTextField = "nm_description"
ddlSubject.DataValueField = "nm_code"
ddlSubject.DataSource = dsdesc.Tables(1)
ddlSubject.DataBind()

Dim ds As New DataSet
If Not Session("dsimage") Is Nothing Then
ds = DirectCast(Session("dsimage"), DataSet)
End If

Dim lblnctcode1 As New Label
lblnctcode1.Text = "Nct Code" + "   " + ":"
lblnctcode1.Attributes.Add("class", "lbl")

Dim lblnctcode As New Label
Session("Nct") = ds.Tables(1).Rows(0).Item("NTCODE").ToString()
lblnctcode.Text = ds.Tables(1).Rows(0).Item("NTCODE").ToString() + "   "
lblnctcode.Attributes.Add("class", "lbl1")

Dim Lbldesc1 As New Label
Lbldesc1.Text = "Description" + "   " + ":"
Lbldesc1.Attributes.Add("class", "lbl")


Dim Lbldesc As New Label
Lbldesc.Text = ds.Tables(1).Rows(0).Item("SUBJECT").ToString() + "   "
Lbldesc.Attributes.Add("class", "lbl1")


Dim LblINVST As New Label
LblINVST.Text = "Investor Name " + "   " + ":"
LblINVST.Attributes.Add("class", "lbl")


Dim LblINVST1 As New Label
LblINVST1.Text = ds.Tables(1).Rows(0).Item("INVNAME").ToString() + "   "
LblINVST1.Attributes.Add("class", "lbl1")

Dim LblFLAGDESC As New Label
LblFLAGDESC.Text = "Flag Description " + "   "
LblFLAGDESC.Attributes.Add("class", "lbl")

Dim LblFLAGDESC1 As New Label
LblFLAGDESC1.Text = ds.Tables(1).Rows(0).Item("FLAGDESC").ToString() + "   "
LblFLAGDESC1.Attributes.Add("class", "lbl1")

Dim LblFolioNo As New Label
LblFolioNo.Text = "Folio No " + "   " + ":"
LblFolioNo.Attributes.Add("class", "lbl")

Dim LblFolioNo1 As New Label
LblFolioNo1.Text = ds.Tables(1).Rows(0).Item("FOLIONUM").ToString()
LblFolioNo1.Attributes.Add("class", "lbl1")

DIVCONTENTLEFT.Controls.Add(lblnctcode1)
DIVCONTENTLEFT.Controls.Add(lblnctcode)

DIVCONTENTLEFT.Controls.Add(Lbldesc1)
DIVCONTENTLEFT.Controls.Add(Lbldesc)

DIVCONTENTLEFT.Controls.Add(LblINVST)
DIVCONTENTLEFT.Controls.Add(LblINVST1)
DIVCONTENTLEFT.Controls.Ad

1 solution

Put your model pop in Update panel and use Trigger for the drop down selected index change event. will solve your problem,



Example


XML
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server" CssClass="pnlAlign">
        <ContentTemplate>

 <asp:Button runat="server" ID="btnShowModalPopup" Style="display: none" />
                    <ajax:ModalPopupExtender ID="mpopRejectAndRework" runat="server" TargetControlID="btnShowModalPopup"
                        PopupControlID="divPopUp" BackgroundCssClass="modalBackground" DropShadow="true"
                        RepositionMode="RepositionOnWindowResize" />
</ContentTemplate>

 <asp:DropDownList ID="ddlStatus" runat="server" Width="200px" AutoPostBack="True" CssClass="input"
                                        OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged">
                                    </asp:DropDownList>
  <Triggers>
            <asp:PostBackTrigger ControlID="ddlStatus" />
        </Triggers>
</asp:UpdatePanel>
 
Share this answer
 

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