<gridview id="Grd" runat="server" autogeneratecolumns="false" cssclass="GridStyle">
HeaderStyle-Font-Size="Small" Width="960" Visible="false">
<columns>
'Columns goes here
<asp:templatefield headertext="Action" headerstyle-width="310px" itemstyle-horizontalalign="Left" xmlns:asp="#unknown">
<itemtemplate>
<asp:button id="btnDelete" runat="server" text="Delete" onclick="btnDelete_Click">
CommandArgument='<%#Eval("intHireEnquiryID") %>' />
<asp:button id="btnPlace" runat="server" text="Place" onclick="btnPlace_Click">
CommandArgument='<%#Eval("intHireEnquiryID") %>' />
Remove the modalpopupextender which was taken inside gridview and keep it in an update panel like below and remember remove the TargetControlId of modalpopupextender from actual button to a dummy button which has no use on the page and hide it. This btnDummy is only to remove the bug of raising error when targetcontrolid is not defined for modalpopup and nothing.
<asp:updatepanel id="upPopupPnl" runat="server" updatemode="Conditional" xmlns:asp="#unknown">
<contenttemplate>
<asp:panel runat="server" id="pnlPopup" width="300px" height="300px" backcolor="Azure">
style="overflow:auto;border-color:Black;border-style:solid;border-width:2px;">
<asp:radiobuttonlist id="rbl1" runat="server">
|
<asp:button id="btnPlacePopup" runat="server" text="Place" width="100" height="35" font-bold="true">
OnClick="btnPlacePopup_Click" />
| <asp:button id="btnCancel" runat="server" text="Cancel" width="100" height="35" font-bold="true">
|
<asp:button id="btnDummy" runat="server" text="Not Display" style="display:none;">
<ajaxtk:modalpopupextender id="actPopup1" runat="server" targetcontrolid="btnDummy" backgroundcssclass="modalBackground" xmlns:ajaxtk="#unknown">
PopupControlID="pnlPopup" CancelControlID="btnCancel">
The Css class is as: -
.modalBackground
{
background-color:#B3B3CC;
opacity:0.5;
}
Code behind: -
dim intHireEnquiryIDas integer
Protected Sub btnPlace_Click(ByVal sender As Object, ByVal e As System.EventArgs)
intHireEnquiryID = CType(sender, Button).CommandArgument
Dim EXP As New Exception
Dim params(0) As SqlParameter
params(0) = New SqlParameter("@intHireEnquiryID", intHireEnquiryID)
Dim DS As New DataSet
DS = execQuery("spAgent_Get_Assigned_Workers", executionType.SPExecuteForDS, EXP, params)
If DS.Tables(0).Rows.Count > 0 Then
rbl1.DataSource = DS
rbl1.DataTextField = "WorkerDetail"
rbl1.DataValueField = "intWorkerID"
rbl1.DataBind()
End If
upPopupPnl.Update()
actPopup1.Show()
End Sub
Thus it works great and fine.
points to remember: -
But remember to remove the TargetControlId of modalpopupextender from actual button to a dummy button which has no use on the page and hide it. And do not set visible property of panel which has to show to true or false. It will handle automatically by ajaxmodalpopupextender.
Actually why i took a dummy button as targetcontrolid of modalpopup because i need to postback the page partially to update the generated list of radiobuttons. but if we take the main button as targetcontrolid then the default behaviour of button will be overridden by modalpopup extender and it will not postback the page. So, i took a dummy button. And on the actual button click event i generate the list and bind it to radiobuttonlist and then called the update method of update panel and then called the show method of modalpopup.
It's fine now....
Thanks to all who tried to help me.
Thanks a lot!!