Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
html:
<head>
<script language=javascript>
function showDialog(){
window.showModalDialog("dialog.aspx", null, "dialogHeight:400px,dialogWidth:500px");
return false;
}
</script>
</head>
<body>
<asp:DataGrid id=DataGrid1 runat=server>
<Columns>
<asp:TemplateColumn>
<asp:LinkButton runt=server id="myLinkButton" Text="Pop up modal dialog" />
</asp:LinkButton>
</asp:TemplateColumn>
</asp:DataGrid>
</body>
code behind:
private void DataGrid2_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
{
LinkButton lb = (LinkButton)e.Item.FindControl("myLinkButton");
if(lb.Attributes["onclick"] == null)
{
lb.Attributes.Add("onclick", "javascript:return showDialog()");
}
}
}
private void InitializeComponent()
{
DataGrid2.ItemDataBound += new DataGridItemEventHandler(DataGrid2_ItemDataBound);
}
html:
<head>
<script language=javascript>
function closeDialog(){
self.close(); // close dialog
window.parent.location.reload(true); // reload parent window from the server
return false;
}
</script>
</head>
<body>
<asp:LinkButton id="lbContinue" runat="server" Text="Continue" />
</body>
code behind
override protected void OnInit(EventArgs e)
{
if(lbContinue.Attributes["onclick"] == null)
{
lbContinue.Attributes.Add("onclick", "javascript:return closeDialog()");
}
}