Following is the Anchor defined in the Gridview where we are passing Session and Eval values as parameter to the Javascript function
OpenAttachmentWindow(roomId,StudentId,Id).
OpenAttachmentWindow(roomId,StudentId,Id).
Javascript function description
<script language="javascript" type="text/javascript">
function OpenAttachmentWindow(roomId, StudentId, Id)
{
var ReadOnly = 0;
window.open('UploadSupplierAttachments.aspx?roomId=' + roomId + '&studentId=' +
StudentId + '&id=' + Id + '&ReadOnly=' + ReadOnly, '', 'width=700,height=500')
}
</script>
Gridview Template column
We have anchor html control which will pas the server side arguments to javascript function.
<asp:TemplateField HeaderText="view">
<ItemTemplate>
<a onclick='<%# "OpenAttachmentWindow(" +Session["roomId"] + " , " +
Session["StudentId"] + ", " + Eval("Id") +" );" %>' id="a1" runat="server" >Attachment </a>
Session["StudentId"] + ", " + Eval("Id") +" );" %>' id="a1" runat="server" >Attachment </a>
</ItemTemplate>
</asp:TemplateField>
No comments:
Post a Comment