ASP.NET - clearing input field after executing button click
Asked By srujan
09-Sep-10 06:20 AM
Hi friends
Iam using input field for entering date....... For this iam using date picker control........It is fine, after clicking on any button in the page its working but the problem is after executing the button click event that my date field is clearing....... how can i solve this problem...........
After button click event other textboxes r not clearing except this date field.........even i dint clear the date field....
so friends please help me............
Thanks & Regards
Sujju
harsh shah replied to srujan
Hi,
After successfull execution of your button event u have clear the text box. it's not automatically clear.
For Example:-
Textbox1.text="";
if u want to clear lable then write.
label1.text="";
Regards,
Harsh Shah
srujan replied to harsh shah
No Sir,
I dont want to clear the input field.......... date field is clearing after executing button click event.........
I want the date wat i selected before button click......... for this iam again entering the date field whenever i click on the button......... means the date field is automatically reseting........ i think now u got my point............ any way thanks for replying sir
Sagar P replied to srujan
Check EnabledViewState of that textbox. If its false then it will clear on each postback otherwise it should not clear the contents.
Also check your code. I think something there in your code you have clear it.... may be on page load...
[ Kirtan ] replied to srujan
Add runat="server" in Input Field in Aspx code
<asp:Calendar ID="Calendar1" runat="server"
onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
<input runat="server" id="Text1" type="text" /><br />
<asp:Button ID="Button3" runat="server" Text="Button" />
harsh shah replied to srujan
ok
set the enable viewstate = true;
it solve the issue
if not solve with this method
then on button click take your date value in a session and then after execution of button fill session value into the textbox on page load.
for example:
on button click
session["Date"]=txtdate.text.tostring();
on page load
if(session["Date"]!="")
{
txtdate.text=session["Date"].tostring();
}
let me know
Regards,
Harsh Shah
sana replied to srujan
i just saw ur post and i dont know u find the solution or not..this prob occurs due to postback prob..on every click event the page is refreshed and so the Page_Load func is called so controls like datetime picker,dropbox,checkbox etc selection are cleared... so use
if (!Page.IsPostBack)
{
//set ur initial value in date time picker here
}
it should work
in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page. %@ Page Language = ”vb” trace = ”true”AutoEventWireup = ”false” Codebehind = ”WebForm1.aspx.vb” Inherits = ”WebApplication2.WebForm1?> 2
renders the same css differently. Very odd. Sir also some other features : in our profile page we are not able to see the symbol of answer unchecked, checked , ignored, 3* , 1 just missed that feature. Sir, now most of things are working fine as expected ! Profile page , My Post Page etc working good ! site looks great ! Sir one thing i notice . . Every posts has the today's Date like DateTime.Now So i think the date field is not getting fetched and not showing the correct info. Just see the starting of post you have posted yesterday but its showing today's date Geez, how in the heck did I miss that? Hi site look very nice, congratulation and reason Regards Sorry for wrong issue, I wish there would be some edit option Check this post. the UI is getting disturbed http: / / www.eggheadcafe.com / community / asp-net / 17
share session between Classic ASP applications and ASP.NET applications? I want to share session state between Classic ASP applications and ASP.NET applications. Can we share ? if yes , How ? Yes, it can. See the article at the user session, and can be used to identify session state for both classic ASP and ASP.NET. Session state information is stored in memory in ASP script and can't be shared with other applications, such as ASP.NET. If the session state is stored in a common format in Microsoft® SQL Server, the
time examples using these. And also need information about its importance in developing applications in asp.net applications. Cheers, Samantha. hi. . State management option View state: Use when you need to store small amounts of information for a page that will post back to itself. Using the ViewState property provides functionality with basic security server. Hidden fields: Use when you need to store small amounts of information for a page that will post back to itself or to another page, and when security is not an issue. You can use a hidden field only on pages that are submitted to the server. Cookies: Use when you need to an issue. Query string: Use when you are transferring small amounts of information from one page to another and security is not an issue. You can use query strings only if you are requesting the same page, or another page via a link. Server Side Management Options Application state Use when you
Management? Hi, Read this, State management is the process by which you maintain state and page information over multiple requests for the same or different pages. Types of State Management There This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator(url), or a cookie. The techniques available to store the state information at the client end are listed down below: a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is