lundi 10 août 2015

Passing value to model from view and extract into another view

I want to Pass value from View to my controller.But I want to Pass value in such a way that When user Click the Button.It will insert data into Model(Class).Then It will pass this data to Controller where controller Method contain one parameter of type Model(Class object).Then It will pass this object to another View by returning.Then On that View I can see my value coming into model class.But in my code problem is that everything is fine button my function from c# code is not calling on click.I am using MVC Web Application Project.Help Me Thanks in Advance.

Sender : -<input runat="server" type="email" id="emailAddressOf" /><br />
    Message :-<br /><textarea runat="server" rows="5" cols="30" id="textAreaOf"></textarea><br />
    <asp:Button runat="server" ID="sendBtn" Text="Send" OnClick="sendBtn_Click" />
<script runat="server">
protected void sendBtn_Click(object sender,EventArgs e)
{
    ModelData data=new ModelData();
    data.email=emailAddressOf.value;
    data.Message=textAreaOf.value;
}
</script>

Aucun commentaire:

Enregistrer un commentaire