Posts

Showing posts from January, 2008

Export To Excel Even With Special Character in Data

The Following C# code is used to Export data from ASP.NET to Excel with special characters try { Response.ContentType = "application/vnd.ms-excel 8.0"; Response.Charset = ""; Response.ContentEncoding = System.Text.Encoding.Default; this.EnableViewState = false; System.IO.StringWriter ObjWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter ObjHtmlTextWriter = new System.Web.UI.HtmlTextWriter(ObjWriter); rptUserDetails.RenderControl(ObjHtmlTextWriter); //dgdInitiative is the Grid name which is to be exported Response.Write(ObjWriter.ToString()); string strhtml = ObjHtmlTextWriter.ToString(); Response.AppendHeader("content-disposition", "attachment;filename=Users.xls"); Response.End(); } catch (System.Exception ex) { string strMsg = ex.Message; }

Never cry...

NEVER CRY FOR ANY RELATION IN LIFE BECAUSE FOR THE ONE WHOM YOU CRY DOES NOT DESERVE YOUR TEARS AND THE ONE WHO DESERVES WILL NEVER LET YOU CRY................. TREAT EVERYONE WITH POLITENESS EVEN THOSE WHO ARE RUDE TO YOU, NOT BECAUSE THEY ARE NOT NICE BUT BECAUSE YOU ARE NICE....................... NEVER SEARCH YOUR HAPPINESS IN OTHERS WHICH WILL MAKE YOU FEEL ALONE, RATHER SEARCH IT IN YOURSELF YOU WILL FEEL HAPPY EVEN IF YOU ARE LEFT ALONE...................... ALWAYS HAVE A POSITIVE ATTITUDE IN LIFE. THERE IS SOMETHING POSITIVE IN EVERY PERSON. EVEN A STOPPED WATCH IS RIGHT TWICE A DAY.................................... HAPPINESS ALWAYS LOOKS SMALL WHEN WE HOLD IT IN OUR HANDS. BUT WHEN WE LEARN TO SHARE IT, WE REALIZE HOW BIG AND PRECIOUS IT IS!
In life Don't Trust people, who change their feelings with time... Trust those people whose feeling remain the same, even when the time changes... Never try to lose dear one who really care you bcoz, you will never get back mirror once it is broken..

To Move items from one ListBox to another Listbox

Image
To Develop a page with the following type of requirement I had used the server side methods for this of asp.net and use updatepanel from ajaxtoolkit to avoid postback to the page. The aspx file code:- <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <table> <tr> <td style="width: 100px; height: 104px"> <asp:ListBox ID="lstReturnFields" runat="server" DataTextField="name" DataValueField="start" Rows="6" SelectionMode="Multiple" Width="150px"> </asp:ListBox> </td> <td align="center" style="height: 104px" valign="middle"> <asp:I

To Convert DateTime format in EST

The Following Function is used to convert datetime of your webserver into EST. Code:- protected DateTime getESTFormatedDatetime(DateTime dtdate) { return TimeZone.CurrentTimeZone.ToUniversalTime(dtdate).AddHours(-5); } Desc:- The function takes an argument of datetime format and return also the datetime format.