This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.
############################## aspx page
<script>
$(document).ready(function () {
$(".dialog-modal-history").dialog({
height: 450,
width: 700,
autoOpen: false,
modal: true,
dialogClass: 'Dialog',
title: 'Work History'
});
$('.butHistoryDialog').click(function () {
$('.dialog-modal-history').dialog('open');
// prevent the default action, e.g., following a link
return false;
});
$('.dialogclose').click(function () {
$('.dialog-modal-history').dialog('close');
// prevent the default action, e.g., following a link
return false;
});
});
function HistoryClick() {
dialog = document.getElementById("butHistoryDialog");
dialog.click();
}
</script>
<asp:Repeater runat="server" ID="rptJobHistory" OnItemDataBound="rptJobHistory_OnItemDataBound">
<ItemTemplate>
<tr class="<%# Container.ItemIndex % 2 == 0 ? "Odd" : "Even" %>">
<td>
<%# Eval("DateStart", "{0:MMM yyyy}")%>
</td>
<td>
<%# ifdatenotend(Eval("DateEnd", "{0:MMM yyyy}"))%>
</td>
<td>
<%# Eval("Title") %>
</td>
<td>
<%# Eval("Company") %>
</td>
<td>
<asp:LinkButton ID="View" runat="server" CommandArgument=<%# Eval("ID") %>>Edit</asp:LinkButton>
</td>
<td>
<asp:LinkButton runat="server" OnClick="Delete" CommandArgument=<%# Eval("ID") %>>Delete</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table></td>
<td><asp:Button ID="butAddJobHistory" runat="server" Text="Add History" SkinID="MessageButton" CssClass="opener" />
<input runat="server" ID="butHistoryDialog" type="button" class="butHistoryDialog" clientidmode="Static" /></td>
</tr>
</table>
####################### code behind
protected void rptJobHistory_OnItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton ViewHistory = e.Item.FindControl("View") as LinkButton;
ViewHistory.Click += new EventHandler(History);
smUpdate.RegisterAsyncPostBackControl(ViewHistory);
ViewHistory.Attributes.Add("onclick", "javascript:HistoryClick();");
}
}
Do more with
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace testApp1
{
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ClientScriptManager cs = Page.ClientScript;
// Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(this.GetType(), "test"))
{
String cstext1 = "HistoryClick();";
cs.RegisterStartupScript(this.GetType(), "test", cstext1, true);
}
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="testApp1.Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function HistoryClick() {
alert("HistoryClick is running");
dialog = document.getElementById("butHistoryDialog");
dialog.click();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="container"></div>
</form>
</body>
</html>
Premium Content
You need an Expert Office subscription to comment.Start Free Trial