2
Answers

How to avoid the Page Refresh when date selected time

Here is my code for select a date in Text box,when i select a date Adds the 5 days in the grid view label column below i am coloured the label,5 days adds correctly using TextChanged event, but one problem is every time the page is refresh how avoid if know share me!
 
Thank You
 
<ItemTemplate><asp:UpdatePanel runat="server" ID="UpId"
UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:TextBox ID="txtScheduleDate" runat="server" CssClass="txt" Width="100px" Text='<%#Eval("schedulePickDate")%>' OnTextChanged="txtScheduleDate_TextChanged" AutoPostBack="true"></asp:TextBox>
<asp:CalendarExtender ID="CaltxtScheduleDate" Format="dd-MM-yyyy" runat="server" TargetControlID="txtScheduleDate">
</asp:CalendarExtender>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
<asp:TemplateField Visible="true" HeaderText="EPD">
<ItemTemplate>
<asp:Label ID="lblEpd" runat="server" Text='<%#Eval("epd")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
 

Answers (2)

3
Photo of Gaurav Raut
NA 171 2 7y
function Show() {
var data = $('#CNform').serialize();
console.log(data);
$.ajax({
type: 'POST',
cache: false,
url: '/CN/Show',
data: data,
success: function (data, textStatus, jqXHR) {
},
error: function (jqXHR, textStatus, errorThrown) {
}
});
}
 
 
And change the type of parameter
//Controller
[HttpPost]
[AcceptVerbs(HttpVerbs.Post)]
public string Show(CNModel modelParameter)
{
// Code
}
Accepted
1
Photo of Faizan Syed
NA 16 1 7y
Thanks @Gaurav Raut
1
Photo of Pravin Ghadge
NA 2.5k 358.5k 7y
Thanx a lot Gaurav.
 
Issue has been resolved .
 
Also one thing i have modified in the cshtml file is:
 
  1. @using (Html.BeginForm(nullnullnew { @id = string.Empty }, FormMethod.Post,  
  2. new { @id = "CNform" })