tag:blogger.com,1999:blog-6082652835152798567.post7617081172886534941..comments2024-03-28T21:41:58.974-07:00Comments on Sql server, .net and c# video tutorial: Part 3 – ViewState in ASP.NETUnknownnoreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6082652835152798567.post-89121045107842320702017-12-21T00:43:05.270-08:002017-12-21T00:43:05.270-08:00Hi Sir
Can we run this ASP.NET project on Visual ...Hi Sir <br />Can we run this ASP.NET project on Visual Studio 2017<br />KRISHNA SHEJULhttps://www.blogger.com/profile/03063770627958457263noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-65062543237782530492016-06-07T05:25:30.444-07:002016-06-07T05:25:30.444-07:00Sir, I want to ask that, is the view state propert...Sir, I want to ask that, is the view state property enabled internally for all asp.net server controls or just for textboxes??<br />I tried a code where i want to upload a picture and want to see that picture before uploading it while it's name is in fileupload's field but when i click the show button before upload button the filename is no more there in the fileupload field & therefore upload button doesn't works.. I want to do this without using viewstate property..<br />Here is a part of my code<br /><br />protected void Button1_Click(object sender, EventArgs e)<br /> {<br /> if (FileUpload1.HasFile)<br /> {<br /> string filename = Path.GetFileName(FileUpload1.FileName);<br /> FileUpload1.SaveAs(Server.MapPath("~/") + filename);<br /> Image1.ImageUrl = Path.GetFileName(FileUpload1.FileName);<br /> Label1.Text = "File Uploaded Successfully";<br /> ViewState["abc"] = FileUpload1.FileName;<br /> }<br /> else<br /> {<br /> Label1.Text = "Error in file upload";<br /> }<br /><br /> }<br /><br /> protected void Button2_Click(object sender, EventArgs e)<br /> {<br /><br /> Image1.ImageUrl = Path.GetFileName(FileUpload1.FileName);<br /><br /> }<br /><br /> i hope u will be able to understand my question...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-79239405545411513022016-06-07T05:16:07.992-07:002016-06-07T05:16:07.992-07:00Sir, I have a question, you said that the viewstat...Sir, I have a question, you said that the viewstate property for the asp.net server controls is internally enabled, so I want to ask that is it true for just textboxes or for all asp.net server controls?<br />Can u just help me with this code because it's not working without using viewstate property<br /><br />protected void Button1_Click(object sender, EventArgs e)<br /> {<br /> if (FileUpload1.HasFile)<br /> {<br /> string filename = Path.GetFileName(FileUpload1.FileName);<br /> FileUpload1.SaveAs(Server.MapPath("~/") + filename);<br /> Image1.ImageUrl = Path.GetFileName(FileUpload1.FileName);<br /> Label1.Text = "File Uploaded Successfully";<br /> ViewState["abc"] = FileUpload1.FileName;<br /> }<br /> else<br /> {<br /> Label1.Text = "Error in file upload";<br /> }<br /><br /> }<br /><br /> protected void Button2_Click(object sender, EventArgs e)<br /> {<br /><br /> Image1.ImageUrl = Path.GetFileName(FileUpload1.FileName);<br /><br /> }<br /><br />in this code I want to upload a picture using Fileupload control but want to see it before uploading but when i click the button 2 the fileupload field becomes empty and I can't upload the picture after that on clicking button 1. I hope u will understand my question??<br />Anonymousnoreply@blogger.com