Modalpop data is not binding to outside label

Posted by Mahesh_Chs under ASP.NET on 1/3/2014 | Points: 10 | Views : 1736 | Status : [Member] | Replies : 5
Hi,

I have a label and i have a textbox inside the modalpopup control i want to show textbox(which is in modalpopup) data to label.

I have written the code like below

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Label ID="lblnotes" runat="server"></asp:Label>
<cc1:ModalPopupExtender ID="ModalPopupExtender4" runat="server" TargetControlID="lnknotesedit"
PopupControlID="panel9" />
<asp:UpdatePanel ID="a" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel9" runat="server" Height="300px">
<input type="button" id="btnclose" value="[ X ]" />
<h2>
Edit Notes
</h2>
<div>
<p>
<asp:TextBox ID="txteditnotes" runat="server" TextMode="MultiLine" Height="150px"
Width="565px" />
</p>
</div>
<div>
<input type="button" id="btncancelnotes" value="Cancel" />
<asp:Button ID="btnupdatenotes" class="button right" runat="server" Text="Update"
ValidationGroup="f" OnClick="btnupdatenotes_Click" />
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<asp:LinkButton class="edit" ID="lnknotesedit" runat="server">Edit</asp:LinkButton>


In code behind

protected void btnupdatenotes_Click(object sender, EventArgs e)
{
lblnotes.Text = txteditnotes.Text;
}


Thanks in advance..




Responses

Posted by: Bandi on: 1/3/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
refer
http://forums.asp.net/t/1527315.aspx

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 1/4/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Please take Label control inside your update panel control,then it will update label also.




Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mahesh_Chs on: 1/6/2014 [Member] Starter | Points: 25

Up
0
Down
Hi vishal,

Thanks for the response. its working fine when we place label inside the updatepanel. but the modalpopup is not hiding properly. The popup panel is adjusting into the particular div. could you please help me on that.

Thanks&Regards
Mahesh

Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: kgovindarao523-21772 on: 1/6/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi mahesh,

Try this code model popup will hide on cancel click...
Javascript code:
function Hidepopup() {alert("");

$find('mpe').hide();
}


<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>
<asp:ModalPopupExtender ID="ModalPopupExtender4" BehaviorID="mpe" runat="server" TargetControlID="lnknotesedit"
PopupControlID="panel9">
</asp:ModalPopupExtender>
<asp:UpdatePanel ID="a" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Panel ID="Panel9" runat="server" Height="300px">
<input type="button" id="btnclose" value="[ X ]" />
<h2>
Edit Notes
</h2>
<div>
<p>
<asp:TextBox ID="txteditnotes" runat="server" TextMode="MultiLine" Height="150px"
Width="565px" />
</p>
</div>
<div>
<input type="button" id="btncancelnotes" value="Cancel" onclick="Hidepopup()" />
<asp:Button ID="btnupdatenotes" class="button right" runat="server" Text="Update"
ValidationGroup="f" OnClick="btnupdatenotes_Click" />
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<asp:LinkButton class="edit" ID="lnknotesedit" runat="server">Edit</asp:LinkButton>


Thank you,
Govind

Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 1/6/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Hi,

Initially at the design time,you have to hide Panel like

<asp:Panel ID="Panel9" runat="server" Height="300px" style="display:none;" >
</asp:Panel>

And in code-behind,write to show panel control as

Panel9.Style["display"] = "block";
//update your updatepanel control as
a.Update();


Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response