I have a gridview that get binds dynamically. i have a linkbutton attached with every row that opens a modal popup window which I need to show some text which is in a hidden field in gridview.
I need to call a javascript function that sets the value of the label in the popup panel with the text of the hidden field. The problem is that the value is always blank when the popup is displayed.
Java script code is -
function SetNotesonModal(note)
{
//debugger;
var notes = document.getElementById(note.id).innerHTML;
document.getElementById('ctl00_ContentPlaceHolder1_popupLblNote').value = notes;
}
Code for calling the function is -
lnkViewNotes.Attributes.Add("OnClick", "return SetNotesonModal(" + e.Row.FindControl("lblNote").ClientID + ");");
The controls in gridview are as -
<ItemTemplate>
<asp:Label ID="lblNote" runat="server" Text='<%# Bind("notes") %>'></asp:Label>
<asp:LinkButton ID="lnkViewNotes" runat="server">View</asp:LinkButton>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="lnkViewNotes" PopupControlID="Panel2" CancelControlID="popupBtnClose">
</asp:ModalPopupExtender>
</ItemTemplate>
And the panel for popup is -
<asp:Panel ID="Panel2" runat="server" ScrollBars="Auto" align="center" Style="display: none"
CssClass="modalPopup">
<table class="border" style="text-align: left; height: 100%" width="100%">
<tr align="left" style="background-color: #5D7B9D; color: White">
<th>
Notes
</th>
</tr>
<tr>
<td>
<asp:Label ID="popupLblNote" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="popupBtnClose" runat="server" Text="Close" />
</td>
</tr>
</table>
</asp:Panel>
The javascript function is being called perfectly and its is also setting value of the label in popup panel correctly but not sure why the popup comes blank every time.
Any kind of help is welcome.
Thanks