Posted by kiranpatils on September 2, 2009
Challenge:
if you are using Calendar control to show Birthday of your friend. So, when you run the application it will show whose b’day is coming in this month or next month or next month …. So, you can be ready for a treat
. The Challenge here is how to select that particular date and how to make it visible while user runs the application?
Solution:
You can set SelectedDate of Calendar Control to show date selected like this:
DateTime dtBirthday = getUpcomingBirthday(); //assume this method returns upcoming b’day in DateTime
calBirthday.SelectedDate = dtBirthday.Date; //use Date here else it won’t work
You can set VisibleDate of Calendar Control to show that date:
calBirthday.VisibleDate= dtBirthday.Date; //use Date here else it won’t work
Here DateTime.Date part it too important. Else it won’t work. Do you know why? i know but it’s homework for you guys
Cheers
Posted in ASP.NET, ASP.NET Controls | Leave a Comment »
Posted by kiranpatils on September 2, 2009
Challenge:
Reset button won’t clear validation control messages.
Solution:
For that you have to write JS onclick of reset button and do hide it like this:
document.getElementById(“regurlarexpressionID”).style.visibility = “hidden”;
See this link:
http://forums.asp.net/t/567612.aspx
Posted in ASP.NET, ASP.NET Controls | Leave a Comment »
Posted by kiranpatils on September 2, 2009
Usually what we do. We open a page and fill up a form and submit a form data by pressing “Submit” Button. And after that we get some data/response as per the logic. But how to do this programmatically?? — That’s what we have been doing since so long..we faced too many challenges and finally we made it working. You also want to do the same then here we go…
First follow this nice article :
http://dotnet.sys-con.com/node/45127
if you follow all the steps and also COPY-PASTE the whole code given below:
http://gemsres.com/photos/story/res/45127/source.html
IT WON’T WORK
As someone has already commented on that post — That it throws Internal Server Error(500). But unfortunately no solution has been answered. But don’t worry. i’m here to answer that
Okay, The problem is in your target ASPX page — Means ASPX Page which has form tag. it should have event validation false:
<%@ Page EnableEventValidation=”false” %>
That’s it. It should work now. And if it dosen’t works then try to debug using Fiddler — Really great tool
Okay, So in short to post form data programmatic ally using ASP.NET following steps are required.
1. ViewState Must be passed.
2. In Target page — enableeventvalidation – false.
3. Fiddler must need to install to see what’s going on
Webliography
http://xneuron.wordpress.com/2007/12/05/programmatically-post-a-form-in-aspnet/
http://schleichermann.wordpress.com/2009/07/13/asp-net-programmatically-submit-form-post/
Hope this helps
Posted in ASP.NET | Leave a Comment »