Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication4.Models.Picture>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Overview
</asp:Content>
<script runat="server">
public void Commit_Click(object sender, EventArgs e)
{
MvcApplication4.Models.Comments kom = new MvcApplication4.Models.Comments();
kom.comment = TextBox1.Text;
kom.CreateDate = DateTime.Now;
MvcApplication4.Controllers.CommentsController k = new MvcApplication4.Controllers.CommentsController();
k.Create(kom);
}
</script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="mainContent" style="width:500px; margin: 20px auto 20px auto; text-align:left;">
Lorem ipsum dolor
</div>
<div id="gallery">
<!-- Ovo je samo test -->
<a href="Index.aspx"><img src="../../Images/1.jpg" alt="My description" title="My title"/></a>
<img src="../../Images/2.jpg" alt="Another text" title="Another title"/>
</div>
<script type ="text/javascript">
Galleria.loadTheme('../../Scripts/galleria/themes/classic/galleria.classic.min.js');
$("#gallery").galleria({
width: 500,
height: 500
});
</script>
<div style="width:800px; margin: 0px auto 0px auto; text-align:center;">
<br /><br />
<form id="Form1" action="/" method="post" runat="server">
<div style="text-align:left; color: Black; width:500px; margin:0px auto 0px auto;">
<asp:Label ID="labelaComment" runat="server" Text= "Unesite vaš komentar:"></asp:Label>
</div>
<br/>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="50px" Width="500px" Rows="0" MaxLength="60" CssClass="commentBox"></asp:TextBox>
<br />
<div style="width:500px; margin:0px auto 0px auto; text-align:right">
<asp:Button ID="Commit" runat="server" OnClick="Commit_Click" OnClientClick="return confirm('Ready to submit.');" />
<input value="Commit" type="button" runat="server" onclick="Commit_Click" />
</div>
</form>
</div>
</asp:Content>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication4.Models.Picture>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Overview
</asp:Content>
<script runat="server">
public void Commit_Click(object sender, EventArgs e)
{
MvcApplication4.Models.Comments kom = new MvcApplication4.Models.Comments();
kom.comment = TextBox1.Text;
kom.CreateDate = DateTime.Now;
MvcApplication4.Controllers.CommentsController k = new MvcApplication4.Controllers.CommentsController();
k.Create(kom);
}
</script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="mainContent" style="width:500px; margin: 20px auto 20px auto; text-align:left;">
Lorem ipsum dolor
</div>
<div id="gallery">
<!-- Ovo je samo test -->
<a href="Index.aspx"><img src="../../Images/1.jpg" alt="My description" title="My title"/></a>
<img src="../../Images/2.jpg" alt="Another text" title="Another title"/>
</div>
<script type ="text/javascript">
Galleria.loadTheme('../../Scripts/galleria/themes/classic/galleria.classic.min.js');
$("#gallery").galleria({
width: 500,
height: 500
});
</script>
<div style="width:800px; margin: 0px auto 0px auto; text-align:center;">
<br /><br />
<form id="Form1" action="/" method="post" runat="server">
<div style="text-align:left; color: Black; width:500px; margin:0px auto 0px auto;">
<asp:Label ID="labelaComment" runat="server" Text= "Unesite vaš komentar:"></asp:Label>
</div>
<br/>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="50px" Width="500px" Rows="0" MaxLength="60" CssClass="commentBox"></asp:TextBox>
<br />
<div style="width:500px; margin:0px auto 0px auto; text-align:right">
<asp:Button ID="Commit" runat="server" OnClick="Commit_Click" OnClientClick="return confirm('Ready to submit.');" />
<input value="Commit" type="button" runat="server" onclick="Commit_Click" />
</div>
</form>
</div>
</asp:Content>
Zasto se ne poziva Commit_Click?!