tag:blogger.com,1999:blog-72683540749301451652024-03-13T06:54:26.132+05:30DotNet TechnologyComplete guide to learn DotNetAnonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-7268354074930145165.post-7989867497069580382013-07-11T19:51:00.000+05:302014-07-17T14:20:00.557+05:30Download Grid Data to excel,Csv and Txt (Tab Delimited File) avoiding Paging <div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;"><br /></span>
<br />
<h3 style="text-align: left;">
<span style="font-size: large;">Here I will explain how to export grid view data to excel, CSV, Text ( Tab Delimited File ) documnets using asp.net without paging problem</span></h3>
<h4 style="text-align: left;">
<span style="font-family: Georgia, Times New Roman, serif;"><span style="background-color: #f6f4ef;"><span style="color: #222222; font-size: x-small;"><span style="line-height: 20px;"><br /></span></span></span><span style="background-color: #f6f4ef; color: #222222; font-size: 13px;">so in one gridview that has filled with Some details, now we need to export gridview data to user selected document based on selection. To implement this functionality first we need to design aspx page like this</span></span></h4>
<div style="text-align: left;">
<br /></div>
<h3 style="text-align: left;">
ASPX page</h3>
<div>
<br /></div>
<div>
<br /></div>
<form id="form1" runat="server"><br />
<div><br />
<table width="100%"><br />
<tr align="right"><br />
<td align="center" width="800"><br />
<br />
<asp:ImageButton ID="imgbtnxlsx" runat="server" ImageUrl="~/Images/xls_file.png"<br />
Height="40" Width="40" ToolTip="xls" OnClick="imgbtnxlsx_Click" /><br />
<asp:ImageButton ID="imgbtntxt" runat="server" ImageUrl="~/Images/txt_file.png" Height="40"<br />
Width="40" ToolTip="txt" OnClick="imgbtntxt_Click" /><br />
<asp:ImageButton ID="imgbtncsv" runat="server" ImageUrl="~/Images/csv_file.png" Height="40"<br />
Width="40" ToolTip="csv" OnClick="imgbtncsv_Click" /><br />
</td><br />
</tr><br />
<tr><br />
<td align="center" width="800"><br />
<br />
<asp:GridView ID="Grid1" runat="server" AllowPaging="true"<br />
<div>
PageSize="10" OnPageIndexChanging="Grid1_PageIndexChanging"<br />
<div>
GridLines="None" AutoGenerateColumns="false"><br />
<div>
<br />
<HeaderStyle HorizontalAlign="Center" Height="35" </div>
<div>
BorderStyle="None" BackColor="#C6401B"<br />
Font-Names="arial" Font-Size="16px" Font-Bold="true" /><br />
<br />
<RowStyle HorizontalAlign="Center" Font-Names="helvetica, arial" </div>
<div>
Font-Size="14px" BackColor="#F2F9FF" Wrap="true"</div>
<div>
Height="35" BorderStyle="None" /><br />
<br />
<div>
<AlternatingRowStyle BackColor="ControlDark" /><br />
<br />
<PagerStyle HorizontalAlign="Center" ForeColor="#8D8D8D" </div>
<div>
Font-Names="helvetica, arial" /><br />
<br />
<Columns><br />
<br />
<asp:BoundField DataField="StateID" HeaderText="StateID" ItemStyle-Width="200" /><br />
<asp:BoundField DataField="CountryID" HeaderText="CountryID"/> </div>
<div>
<asp:BoundField DataField="StateName" HeaderText="StateName" /></div>
<div>
<asp:BoundField DataField="Abbreviation" HeaderText="Abbreviation" /> </div>
<div>
<br />
</Columns><br />
</asp:GridView><br />
</td><br />
</tr><br />
</table><br />
</div><br />
</form></div>
</div>
</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<h2 style="text-align: left;">
CODE :-</h2>
<div>
<br /></div>
<div>
<div>
using System;</div>
<div>
using System.Collections.Generic;</div>
<div>
using System.Linq;</div>
<div>
using System.Web;</div>
<div>
using System.Web.UI;</div>
<div>
using System.Web.UI.WebControls;</div>
<div>
using System.Text;</div>
<div>
using System.Data.SqlClient;</div>
<div>
using System.Data;</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
protected void Page_Load(object sender, EventArgs e)</div>
<div>
{</div>
<div>
if (!IsPostBack)</div>
<div>
{</div>
<div>
BindGridd();</div>
<div>
}</div>
<div>
}</div>
<div>
<br /></div>
<div>
private void BindGridd()</div>
<div>
{</div>
<div>
SqlConnection con = new SqlConnection(@"Data Source=Servername;Initial Catalog=DBname;</div>
<div>
User ID=username;Password=password");</div>
<div>
SqlCommand cmd = new SqlCommand("select * from tablename", con);</div>
<div>
SqlDataAdapter da = new SqlDataAdapter(cmd);</div>
<div>
DataSet ds = new DataSet();</div>
<div>
con.Open();</div>
<div>
da.Fill(ds);</div>
<div>
Session["GridData"] = ds;</div>
<div>
Grid1.DataSource = ds;</div>
<div>
Grid1.DataBind();</div>
<div>
con.Close();</div>
<div>
<br /></div>
<div>
}</div>
<div>
<br /></div>
<div>
protected void Grid1_PageIndexChanging(object sender, GridViewPageEventArgs e)</div>
<div>
{</div>
<div>
Grid1.PageIndex = e.NewPageIndex;</div>
<div>
Grid1.DataSource = Session["GridData"]; ;</div>
<div>
Grid1.DataBind();</div>
<div>
}</div>
<div>
<br /></div>
<div>
protected void imgbtnxlsx_Click(object sender, ImageClickEventArgs e)</div>
<div>
{</div>
<div>
Response.ClearContent();</div>
<div>
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "xcell.xls"));</div>
<div>
Response.ContentType = "application/text";</div>
<div>
Grid1.AllowPaging = false;</div>
<div>
Grid1.DataSource = Session["GridData"];</div>
<div>
Grid1.DataBind();</div>
<div>
StringBuilder strbldr = new StringBuilder();</div>
<div>
for (int i = 0; i < Grid1.Columns.Count; i++)</div>
<div>
{</div>
<div>
//separting header columns text with comma operator</div>
<div>
strbldr.Append(Grid1.Columns[i].HeaderText + '\t');</div>
<div>
}</div>
<div>
//appending new line for gridview header row</div>
<div>
strbldr.Append("\r\n");</div>
<div>
for (int j = 0; j < Grid1.Rows.Count; j++)</div>
<div>
{</div>
<div>
for (int k = 0; k < Grid1.Columns.Count; k++)</div>
<div>
{</div>
<div>
//separating gridview columns with comma</div>
<div>
strbldr.Append(Grid1.Rows[j].Cells[k].Text + '\t');</div>
<div>
}</div>
<div>
//appending new line for gridview rows</div>
<div>
strbldr.Append("\r\n");</div>
<div>
}</div>
<div>
Response.Write(strbldr.ToString());</div>
<div>
Response.End();</div>
<div>
<br /></div>
<div>
}</div>
<div>
<br /></div>
<div>
protected void imgbtntxt_Click(object sender, ImageClickEventArgs e)</div>
<div>
{</div>
<div>
Response.ClearContent();</div>
<div>
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "txtfile.txt"));</div>
<div>
Response.ContentType = "application/text";</div>
<div>
Grid1.AllowPaging = false;</div>
<div>
Grid1.DataSource = Session["GridData"];</div>
<div>
Grid1.DataBind();</div>
<div>
StringBuilder strbldr = new StringBuilder();</div>
<div>
for (int i = 0; i < Grid1.Columns.Count; i++)</div>
<div>
{</div>
<div>
//separting header columns text with comma operator</div>
<div>
strbldr.Append(Grid1.Columns[i].HeaderText + ' ');</div>
<div>
}</div>
<div>
//appending new line for gridview header row</div>
<div>
strbldr.Append("\r\n");</div>
<div>
for (int j = 0; j < Grid1.Rows.Count; j++)</div>
<div>
{</div>
<div>
for (int k = 0; k < Grid1.Columns.Count; k++)</div>
<div>
{</div>
<div>
//separating gridview columns with comma</div>
<div>
strbldr.Append(Grid1.Rows[j].Cells[k].Text + ' ');</div>
<div>
}</div>
<div>
//appending new line for gridview rows</div>
<div>
strbldr.Append("\r\n");</div>
<div>
}</div>
<div>
Response.Write(strbldr.ToString());</div>
<div>
Response.End();</div>
<div>
}</div>
<div>
<br /></div>
<div>
protected void imgbtncsv_Click(object sender, ImageClickEventArgs e)</div>
<div>
{</div>
<div>
Response.ClearContent();</div>
<div>
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}","csvfil.csv"));</div>
<div>
Response.ContentType = "application/text";</div>
<div>
Grid1.AllowPaging = false;</div>
<div>
Grid1.DataSource = Session["GridData"];</div>
<div>
Grid1.DataBind();</div>
<div>
StringBuilder strbldr = new StringBuilder();</div>
<div>
for (int i = 0; i < Grid1.Columns.Count; i++)</div>
<div>
{</div>
<div>
//separting header columns text with comma operator</div>
<div>
strbldr.Append(Grid1.Columns[i].HeaderText + ',');</div>
<div>
}</div>
<div>
//appending new line for gridview header row</div>
<div>
strbldr.Append("\n");</div>
<div>
for (int j = 0; j < Grid1.Rows.Count; j++)</div>
<div>
{</div>
<div>
for (int k = 0; k < Grid1.Columns.Count; k++)</div>
<div>
{</div>
<div>
//separating gridview columns with comma</div>
<div>
strbldr.Append(Grid1.Rows[j].Cells[k].Text + ',');</div>
<div>
}</div>
<div>
//appending new line for gridview rows</div>
<div>
strbldr.Append("\n");</div>
<div>
}</div>
<div>
Response.Write(strbldr.ToString());</div>
<div>
Response.End();</div>
<div>
}</div>
<div>
<br /></div>
<div>
Note: This function is used to avoid the error like <span style="background-color: #f6f4ef; border: 0px; color: #222222; font-family: Verdana, sans-serif; font-size: 10pt; margin: 0px; padding: 0px; vertical-align: baseline;"> “<b>control must be placed in inside of form tag</b>”.</span><span style="background-color: white; border: 0px; color: #222222; font-family: Verdana, sans-serif; font-size: 10pt; margin: 0px; padding: 0px; vertical-align: baseline;"> If we set</span><b style="background-color: #f6f4ef; color: #222222; font-family: Georgia, Times, 'Times New Roman'; font-size: 14px;"><span style="border: 0px; font-family: Verdana, sans-serif; font-size: 10pt; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">VerifyRenderingInServerForm</span></b><span style="background-color: #f6f4ef; border: 0px; color: #222222; font-family: Verdana, sans-serif; font-size: 10pt; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span style="background-color: white; border: 0px; color: #222222; font-family: Verdana, sans-serif; font-size: 10pt; margin: 0px; padding: 0px; vertical-align: baseline;">function then compiler will think that controls rendered before exporting and our functionality will work perfectly.</span></div>
<div>
<br /></div>
<div>
<span style="color: #3d85c6;"> </span><span style="color: #351c75;">public override void VerifyRenderingInServerForm(Control control)</span></div>
<div>
<span style="color: #351c75;"> {</span></div>
<div>
<span style="color: #351c75;"><br /></span></div>
<div>
<span style="color: #351c75;"> /* method must be implemented when using RenderControl */</span></div>
<div>
<span style="color: #351c75;"><br /></span></div>
<div>
<span style="color: #351c75;"> }</span></div>
<div>
<span style="color: #351c75;"><br /></span></div>
<div>
<span style="color: #351c75;">And final Output Will be........</span></div>
<div>
<h2>
OutPut:-</h2>
<span style="color: #351c75;"></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #351c75;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6JVBI1Tf0q58gNmibofCtbMEGEsIM__2RL-B_PgM05aCE6cjwxbdS3jX5_ThJM28Lk-1ZVufPhSiKF6OxL_RHa9ogBQVmPIp6WAk1O6NA6_4h12v7BqrXqRNGsbWGWsSOD5eu8HcRzg/s1600/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6JVBI1Tf0q58gNmibofCtbMEGEsIM__2RL-B_PgM05aCE6cjwxbdS3jX5_ThJM28Lk-1ZVufPhSiKF6OxL_RHa9ogBQVmPIp6WAk1O6NA6_4h12v7BqrXqRNGsbWGWsSOD5eu8HcRzg/s1600/1.JPG" height="178" width="320" /></a></span></div>
<span style="color: #351c75;">
</span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #351c75;"><br /></span></div>
<span style="color: #351c75;">
</span>
<br />
<h2 style="text-align: center;">
<span style="color: #351c75;">
<u>CSV</u></span></h2>
<span style="color: #351c75;">
<br />
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #351c75;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTCpXJg1QGO6f8ki8Bi2B2ZmapvfgQ3X_L9JfF-pqydczYaiGkXFFqBRctzgS03AGXz0-8zq_lG5K0wf1XH0pHLM7PxGH-V5iJw-k4PI1TxaUwkFzG0hQvc6MMJSj8W7p_f97sZVeH_A/s1600/csv.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTCpXJg1QGO6f8ki8Bi2B2ZmapvfgQ3X_L9JfF-pqydczYaiGkXFFqBRctzgS03AGXz0-8zq_lG5K0wf1XH0pHLM7PxGH-V5iJw-k4PI1TxaUwkFzG0hQvc6MMJSj8W7p_f97sZVeH_A/s1600/csv.JPG" /></a></span></div>
<span style="color: #351c75;">
</span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #351c75;"><br /></span></div>
<span style="color: #351c75;">
</span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #351c75;"><br /></span></div>
<span style="color: #351c75;">
</span>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #351c75;"><br /></span></div>
<span style="color: #351c75;">
<h2 style="text-align: center;">
EXCEL</h2>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGMfc5miGSTKl86v-Wz-PEdEPYjbcAEfH_ME4V3fZRChcet4mB4pQOH9XopNz7vkcE86Nbc4Lvnv6BKFlnaUy4teV9oKmXPi4gUPwhMGj9w21vgLsMOUwuJnWQbTYbz8Wgn0TLLFWozQ/s1600/excell.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGMfc5miGSTKl86v-Wz-PEdEPYjbcAEfH_ME4V3fZRChcet4mB4pQOH9XopNz7vkcE86Nbc4Lvnv6BKFlnaUy4teV9oKmXPi4gUPwhMGj9w21vgLsMOUwuJnWQbTYbz8Wgn0TLLFWozQ/s1600/excell.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h2 style="text-align: center;">
NOTEPAD</h2>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbm2unFd6kGQcqtNMD8wpfDVnxSUdULmzC2TDZpcMza2uGb565kt3sIcwaOkAkSdCKiuljobmU29f-VG6mlhNj7PeqfcSP9TA7Z5KITp9ZzuuEchNgjoqvZFeZZRBAg6wlYq_wwiDzZw/s1600/notepad.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbm2unFd6kGQcqtNMD8wpfDVnxSUdULmzC2TDZpcMza2uGb565kt3sIcwaOkAkSdCKiuljobmU29f-VG6mlhNj7PeqfcSP9TA7Z5KITp9ZzuuEchNgjoqvZFeZZRBAg6wlYq_wwiDzZw/s1600/notepad.JPG" /></a></div>
</span></div>
<div>
<br /></div>
<h2 style="text-align: left;">
</h2>
<div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-22241128513941281012013-04-24T14:07:00.003+05:302014-07-17T14:20:08.344+05:30Blocking HTML Tags OR Allow only one HTML Tag for Text box using java script<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<b>Blocking HTML Tags OR Allow only one HTML Tag for Text box using </b><b>java script</b><br />
<br />
<u>Script :-</u><br />
<br />
<script type="text/javascript"><br />
function ScriptTagsValidation(e, objCtrl) {<br />
var key = window.event ? e.keyCode : e.which;<br />
var keychar = String.fromCharCode(key);<br />
var PreviousValue = objCtrl.value;<br />
var containchars;<br />
var count = 0;<br />
if (keychar == "<" || keychar == ">") {<br />
var Tags = "<>";<br />
for (var d = 0; d < PreviousValue.length; d++) {<br />
containchars = PreviousValue.charAt(d);<br />
if (Tags.indexOf(containchars) != -1) {<br />
count++;<br />
}<br />
}<br />
if (count == 1) {<br />
return false;<br />
}<br />
}<br />
return true;<br />
}<br />
</script><br />
<br />
<u>Design :-</u><br />
<br />
<asp:TextBox ID="TextBox1" runat="server" onkeypress="return ScriptTagsValidation(event,this);"></asp:TextBox></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-65027325350931018472012-09-05T10:56:00.002+05:302014-07-17T14:20:16.438+05:30Bind DropdownList without postback using javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
<span style="color: red;"> </span></h2>
<div>
Generally dropdownlist is the most useful control in our applications but in some cases it is difficult to get flexible binding. This type of binding done by javascript is more efficient and easy to handle.<br />
<br />
This type of binding can get data from PageMethods (or) WebServices etc. By getting the data we can bind to dropdownlist through javascript.<br />
<br />
<u>JAVASCRIPT:</u><br />
<u><br /></u>
<script type="text/javascript"><br />
<br />
function pageLoad() {<br />
PageMethods.GetData(CallMethod);<br />
}<br />
<br />
function CallMethod(result) {<br />
var ddl = document.getElementById("ddl");<br />
for (D = 0; D < result.length; D++) {<br />
opt = new Option(result[D], result[D]);<br />
ddl.add(opt);<br />
}<br />
}<br />
<br />
</script><br />
<br />
pageLoad function is just similar to PageLoad event is server side. In clientside pageLoad i am calling PageMethods and getting the data here. The obtained data is in the form of "<span style="color: red;">List</span>" and can be easily handled.<br />
<br />
<u>PAGEMETHODS:</u><br />
[WebMethod(EnableSession=true)]<br />
public static List<string> GetData()<br />
{<br />
List<string> list = new List<string>();<br />
list.Add("one");<br />
list.Add("two");<br />
list.Add("three");<br />
list.Add("four");<br />
list.Add("five");<br />
return list;<br />
}<br />
<br />
Here in this case i have done a sample list<string>. The final List will get returned to the javascript function.<br />
<br />
Sample code will be obtained here <a href="https://www.dropbox.com/s/mzh2pmg05vvvfad/BindDropDownClientSide.rar" target="_blank">Click Here</a></div>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com1tag:blogger.com,1999:blog-7268354074930145165.post-47131140804621872862012-07-27T18:21:00.001+05:302014-07-17T14:20:24.486+05:30Upload Image and show preview without clicking any button manually<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h2 style="text-align: left;">
<b><u>Upload Image and show preview without clicking any Button Manually</u></b></h2>
<br />
<h4 style="text-align: left;">
<b><u>In .aspx page Directory:</u></b></h4>
<br />
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileUpload.aspx.cs" Inherits="RadUpload.FileUpload" <span style="background-color: white;">EnableEventValidation="false" %></span><br />
<br />
<h4 style="text-align: left;">
<u>Script</u></h4>
<br />
<script language="javascript"><br />
<br />
function Change(obj) {<br />
__doPostBack("<%= Button1.ClientID %>", "");<br />
}<br />
<br />
</script><br />
<br />
<br />
<asp:UpdatePanel ID="UPanel" runat="server"><br />
<ContentTemplate><br />
<table width="100%"><br />
<tr><br />
<td align="center"><br />
<img id="imgUploadImage" runat="server" style="height: 200px; width: 200px;" /><br />
</td><br />
</tr><br />
<tr><br />
<td align="center"><br />
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Change(this);" /><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" Visible="False" /><br />
</td><br />
</tr><br />
</table><br />
</ContentTemplate><br />
<Triggers><br />
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /><br />
</Triggers><br />
</asp:UpdatePanel><br />
<br />
<br />
<h4 style="text-align: left;">
<u>
CodeBehind Page</u></h4>
<span style="background-color: white;">protected void Button1_Click(object sender, EventArgs e)</span><br />
{<br />
int FileSize = FileUpload1.PostedFile.ContentLength;<br />
byte[] bytFileBinary = new byte[FileSize];<br />
FileUpload1.PostedFile.InputStream.Read(bytFileBinary, 0, (int)FileUpload1.PostedFile.ContentLength);<br />
imgUploadImage.Src = "data:image/png;base64," + Convert.ToBase64String(bytFileBinary);<br />
}<br />
<br />
<u>final Out Put :</u><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtevuJVRlI2zVRZh-wm3bwf1HZq1VNYhB40LA2uHPv2_qahm2gXQ1EP3MOV7lbS7ZhlJ2vwx4aGxZsYDNrfpLyfDRSYB9760QuYrhbpWtQcD5eqr7iMoFxbeZTeQX1wb3hLIl_BB_wpw/s1600/Capture.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtevuJVRlI2zVRZh-wm3bwf1HZq1VNYhB40LA2uHPv2_qahm2gXQ1EP3MOV7lbS7ZhlJ2vwx4aGxZsYDNrfpLyfDRSYB9760QuYrhbpWtQcD5eqr7iMoFxbeZTeQX1wb3hLIl_BB_wpw/s1600/Capture.JPG" /></a></div>
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com1tag:blogger.com,1999:blog-7268354074930145165.post-86770148247737601632012-06-22T13:54:00.000+05:302014-07-17T14:20:30.654+05:30How to Call Method Or Function Or Button From Java Script<div dir="ltr" style="text-align: left;" trbidi="on">
Call Method Or Function Or Button From Java Script<br />
<div>
<br /></div>
<div>
Actually we can call button from java script and it will lead the post back also </div>
<h4 style="text-align: left;">
<span style="background-color: white;"><span style="color: orange;"> </span><u><span style="color: red;">Example :</span></u></span></h4>
<div>
<span style="background-color: white;"><span style="color: orange;"> </span> First Add This Property to the Page Directory</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;"> <span style="color: blue;"> EnableEventValidation="false"</span></span><br />
<span style="background-color: white;"><br /></span>
here:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0IrUFRDANT1FfASRo7CQVXN9VSl9hSb9YJFJG_OvcN85mHvNTv1qVPOMdq2UHa-BU1y2LCyA4cH4VMz__c1wRMTaLXeO4VKiCyFkjBjqUVo4OaxLfm2qC153FyF3Z3rRJnKV632LrqQ/s1600/sd.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0IrUFRDANT1FfASRo7CQVXN9VSl9hSb9YJFJG_OvcN85mHvNTv1qVPOMdq2UHa-BU1y2LCyA4cH4VMz__c1wRMTaLXeO4VKiCyFkjBjqUVo4OaxLfm2qC153FyF3Z3rRJnKV632LrqQ/s640/sd.JPG" height="40" width="640" /></a></div>
<span style="color: orange;"><br /></span>
<span style="background-color: white;"><span style="color: orange;"><br /></span></span>
<br />
<span style="background-color: white;"><span style="color: orange;"> </span></span><br />
<span style="background-color: white;"><span style="color: orange;"> </span><span style="color: red;">1)</span><span style="color: orange;"> </span>when click on button or any control call java script as below</span></div>
<div>
<span style="background-color: white;"><span style="color: orange;"> </span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZP899QDso-BaMZO578kPb295pJkgPGzbZBOgXj1PZxNQAHA4a1pnK1rgjBIv_alk09FKpEmUwvIssR6txlHz3tbPZhH7gH5fH3WgM9mHjRxIeUI0BUI3I4yGgYAdbDWiCQWW4xfdmgA/s1600/btnd.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZP899QDso-BaMZO578kPb295pJkgPGzbZBOgXj1PZxNQAHA4a1pnK1rgjBIv_alk09FKpEmUwvIssR6txlHz3tbPZhH7gH5fH3WgM9mHjRxIeUI0BUI3I4yGgYAdbDWiCQWW4xfdmgA/s640/btnd.JPG" height="17" width="640" /></a></div>
<div>
<span style="background-color: white;"><span style="color: orange;"> </span></span></div>
<div>
<br /></div>
<div>
<span style="color: red;"> 2)</span> the Java script function :</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKjr_RA9TsB9GWLyN5KRGwZ6f5KR86V2W34QPL1cyAVFB3qdZCgV4NERyxlIERHnEPZIdcUotLuCLWWpm4Kw2Z_n1KBe4gkkgt-G1GRaunkfzaNmGSrP0dDnx6yRYfcaOHoqyzlnqPhA/s1600/js.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKjr_RA9TsB9GWLyN5KRGwZ6f5KR86V2W34QPL1cyAVFB3qdZCgV4NERyxlIERHnEPZIdcUotLuCLWWpm4Kw2Z_n1KBe4gkkgt-G1GRaunkfzaNmGSrP0dDnx6yRYfcaOHoqyzlnqPhA/s640/js.JPG" height="72" width="640" /></a></div>
<div>
<br /></div>
<div>
<span style="color: red;"> 3)</span> this OK button place in the page like this</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPXFhnNh_cQjUqgl3WaCaHoKD6OFs4xqkGeQhe1o-EB84oe4NKVeeLxszvvmjF0O8f6ivlInAi45r8LsVmjwld61h8Bw3qi1eK8klUn1y_uvwq94gOGmgaUxEYqqpvGpsvZ7l-_I9y2g/s1600/button.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPXFhnNh_cQjUqgl3WaCaHoKD6OFs4xqkGeQhe1o-EB84oe4NKVeeLxszvvmjF0O8f6ivlInAi45r8LsVmjwld61h8Bw3qi1eK8klUn1y_uvwq94gOGmgaUxEYqqpvGpsvZ7l-_I9y2g/s640/button.JPG" height="16" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="color: red;"> 4)</span> so the button OK will call in server side:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQQxtDasAtF0LGL_nMk89dWQhtSTtVY-E94nYjgUBrwASPfY6t7BODVHgTb_z_f-Ti3dJo18r5SOlT-c6XTIKr-bxnACJi3ZstF0V508cVg_iKh_iHhK89avi7b7c77suweTmF3L-c0w/s1600/ser.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQQxtDasAtF0LGL_nMk89dWQhtSTtVY-E94nYjgUBrwASPfY6t7BODVHgTb_z_f-Ti3dJo18r5SOlT-c6XTIKr-bxnACJi3ZstF0V508cVg_iKh_iHhK89avi7b7c77suweTmF3L-c0w/s640/ser.JPG" height="112" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
Like this we can call Method Or Function Or Button From Java Script</div>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-65422938820355771582012-05-28T17:10:00.003+05:302014-07-17T14:21:01.265+05:30Image Mouse Hover in asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
To show image in particular div when mouse hover on the image using asp.net<br />
<br />
<h4 style="text-align: left;">
Script</h4>
<div style="text-align: left;">
<script type="text/javascript" language="javascript"></div>
<div style="text-align: left;">
<br /></div>
function ShowToolTip(con) {<br />
document.getElementById("div_img").style.visibility = "visible";<br />
document.getElementById("img_tool").src = con.src;<br />
document.getElementById("div_img").style.left = event.clientX;<br />
document.getElementById("div_img").style.top = event.clientY;<br />
document.getElementById("div_img").style.zIndex = "0";<br />
}<br />
<br />
function hideToolTip() {<br />
document.getElementById("div_img").style.visibility = "hidden";<br />
}<br />
<br />
</script><br />
<br />
<h4>
Note:write this script in head tag</h4>
<br />
<h4 style="text-align: left;">
Design:</h4>
<br />
<form id="form1" runat="server"><br />
<div><br />
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/3.jpg" Height="50px" Width="50px"<br />
onmouseover="ShowToolTip(this);" onmouseout="hideToolTip();" /><br />
<br /><br />
<br /><br />
<div id="div_img" style="height: 300px; width: 300px; border: solid 1px black; position: absolute;<br />
visibility: hidden;"><br />
<img id="img_tool" height="100%" width="100%" /><br />
</div><br />
</div><br />
</form><br />
<br />
<h4 style="text-align: left;">
Final Output:</h4>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY9eCs8np6w6NOOwyYKOajfcbZ1EWqnh_IQSBwFS_e0hg2lmjgw6MhE1Cv9xscfi-8TvRxVFSfn_ZON9mZQMtU7Y7x9JQ3iVcKTgJBRJl8tQIzL_27T6L1lxhT40uDIzWKKxnkIjNLHw/s1600/df.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY9eCs8np6w6NOOwyYKOajfcbZ1EWqnh_IQSBwFS_e0hg2lmjgw6MhE1Cv9xscfi-8TvRxVFSfn_ZON9mZQMtU7Y7x9JQ3iVcKTgJBRJl8tQIzL_27T6L1lxhT40uDIzWKKxnkIjNLHw/s400/df.JPG" height="400" title="Image Mouse hover in asp.net" width="325" /></a></div>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-87119234040269612872012-05-28T13:53:00.000+05:302014-07-17T14:21:08.870+05:30Replace characters in javascript<div dir="ltr" style="text-align: left;" trbidi="on">
In server side we have "Replace" method to replace the characters in a string but on javascript replace method will be not useful in certain cases instead of that we can do for loop to replace the particular characters and get the specific output.<br />
<br />
<h4 style="text-align: left;">
Example :</h4>
<span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><span style="line-height: 20px;"></span></span><br />
<span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"> </span><span style="color: #333333; font-family: inherit;">var StringChar = "this is my 324o234u324t2342p234u234t"; //Your string to get replaced</span><br />
<span style="color: #333333; font-family: inherit;"> In this case i need to remove the numbers and get the filtered output.</span><br />
<span style="color: #333333; font-family: inherit;"><br /></span>
<span style="color: #333333; font-family: inherit;"> Replace Method in Javascript :</span><br />
<span style="color: #333333; font-family: inherit;"> var ReplacedCharacters = String.replace("0123456789"," ");</span><br />
<span style="font-family: inherit;"><span style="color: #333333;"> Output : <b>"</b></span><span style="color: #333333;"><b>this is my 324o234u324t2342p234u234t</b></span><span style="color: #333333;"><b>"</b>; </span></span><br />
<span style="font-family: inherit;"><span style="color: #333333;"><br /></span></span>
<span style="color: #333333; font-family: inherit;"> In this cases we can do like this :</span><br />
<span style="color: #333333; font-family: inherit;"> var ReplacedChar = "";</span><br />
<span style="color: #333333; font-family: inherit;"> var Characters = "";</span><br />
<span style="color: #333333; font-family: inherit;"> var InValidChars = "0123456789";</span><br />
<span style="color: #333333; font-family: inherit;"> for (d = 0; d < StringChar.length; d++) {</span><br />
<span style="color: #333333; font-family: inherit;"> Characters = StringChar.charAt(d);</span><br />
<span style="color: #333333; font-family: inherit;"> if (InValidChars.indexOf(Characters) == -1) {</span><br />
<span style="color: #333333; font-family: inherit;"> ReplacedChar = ReplacedChar + Characters;</span><br />
<span style="color: #333333; font-family: inherit;"> }</span><br />
<span style="font-family: inherit;"><span style="color: #333333;"> the resulting output is : </span><span style="color: #333333;">ReplacedChar = </span><span style="color: #333333;"><b>this is my output</b></span></span><br />
<span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><br /></span>
<span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><br /></span></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-1355354385060402812012-05-26T16:41:00.001+05:302014-07-17T14:21:16.375+05:30Word Documents and Excel Documents in IFRAME<div dir="ltr" style="text-align: left;" trbidi="on">
In this below example we are converting word OR excel document to HTML.<br />
<br />
In this case we are converting and giving converted HTML file as ""src"" to ""iframe"".<br />
<br />
<u>Step By Step Procedure</u> :<br />
<br />
1)First step is create one folder in your application which needs to maintain the documents in that because iframe will take src within the application itself,outside of the application it will not work.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitALo1S9-NjvaHIFcyevmG0ZJC-9on1HCvlGTeM4Pqfd_Hdqb_nXaZTjTONtmjp4saN-bobDmA659EioEYmn7I-bmTBAixrBIme9tlKxdhYsmA_KuyefCQOG85paKkXcYTElexPrEG3w/s1600/DocFolder.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitALo1S9-NjvaHIFcyevmG0ZJC-9on1HCvlGTeM4Pqfd_Hdqb_nXaZTjTONtmjp4saN-bobDmA659EioEYmn7I-bmTBAixrBIme9tlKxdhYsmA_KuyefCQOG85paKkXcYTElexPrEG3w/s1600/DocFolder.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
2) The aspx page as follows :</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<asp:ScriptManager ID="ScriptManager2" runat="server"></div>
<div class="separator" style="clear: both;">
</asp:ScriptManager></div>
<div class="separator" style="clear: both;">
<div></div>
<div class="separator" style="clear: both;">
<table></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td valign="middle" align="center"></div>
<div class="separator" style="clear: both;">
<asp:FileUpload ID="FileUpload2" runat="server" /></div>
<div class="separator" style="clear: both;">
<asp:Button ID="btnView" runat="server" Text="View" onclick="btnView_Click" /></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="100%"></div>
<div class="separator" style="clear: both;">
<asp:UpdatePanel ID="panel2" runat="server"></div>
<div class="separator" style="clear: both;">
<ContentTemplate></div>
<div class="separator" style="clear: both;">
<div style="background-color: ThreeDFace;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblFileName" runat="server"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</div></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<iframe id="docPreview" src="" width="100%" height="500px" frameborder="0" runat="server"></div>
<div class="separator" style="clear: both;">
</iframe></div>
<div class="separator" style="clear: both;">
</ContentTemplate></div>
<div class="separator" style="clear: both;">
</asp:UpdatePanel></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
</table></div>
<div class="separator" style="clear: both;">
</div></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
3) Add Interop.Excel & Interop.Word dll references for the application :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZJU6wWBK6C-zlj0brw93yIke6mGUytiY7qCNMbX3VRORXc5rEldVoJzm2aj84Qz_5C5kqNaG2p2KnmaAKIVQiTQUTppoZwuHx0FFwFwIGYmqcx9PkZIXnU-xoM90-MSf1GXwYVGpS-w/s1600/dll's.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZJU6wWBK6C-zlj0brw93yIke6mGUytiY7qCNMbX3VRORXc5rEldVoJzm2aj84Qz_5C5kqNaG2p2KnmaAKIVQiTQUTppoZwuHx0FFwFwIGYmqcx9PkZIXnU-xoM90-MSf1GXwYVGpS-w/s1600/dll's.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://www.dropbox.com/s/etz3950fvyoazrx/WordToXl%28DLL%27s%29.rar" target="_blank">Click here to get the dll's</a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both;">
4) The button click event will be like this :</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
First get the binary data of file and save that file to its original format in documents folder.After saving the file according to the file extension convert to Html format and give the Html file as src for iframe.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">private Word.ApplicationClass MSWord; // The Interop Object for Word</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">private Excel.ApplicationClass MSExcel; // The Interop Object for Excel</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">object Unknown = Type.Missing;<span class="Apple-tab-span" style="white-space: pre;"> </span> // For passing Empty values</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">protected void Page_Load(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">{</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> </span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">}</span></div>
<br />
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">protected void btnView_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">{</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> byte[] BinaryFile = null;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> if (FileUpload2.PostedFile != null)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> int FileSize = FileUpload2.PostedFile.ContentLength;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> BinaryFile = new byte[FileSize];</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> FileUpload2.PostedFile.InputStream.Read(BinaryFile, 0, (int)FileUpload2.PostedFile.ContentLength);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> string FileName = FileUpload2.FileName;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> lblFileName.Text = FileName;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> string FileExtension = Path.GetExtension(FileName);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> string FolderPath = Server.MapPath("~/Documents");</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> File.WriteAllBytes(FolderPath + "\\" + FileName, BinaryFile);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> if (FileExtension == ".doc" || FileExtension == ".docx")</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ConvertWordToHTML(FolderPath + "\\" + FileName, FolderPath + "\\" + FileName.Split('.')[0] + ".html");</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> else if (FileExtension == ".xls" || FileExtension == ".xlsx")</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ConvertExcelToHTML(FolderPath + "\\" + FileName, FolderPath + "\\" + FileName.Split('.')[0] + ".html");</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> docPreview.Attributes["src"] = "../Documents/" + FileName.Split('.')[0] + ".html";</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">}</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
This method is used to convert WordDocument to HTML :</div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">public void ConvertWordToHTML(object FilePath, object SaveTarget)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">{</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> if (MSWord == null)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord = new Word.ApplicationClass();</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.Visible = false;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.Application.Visible = false;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.WindowState = Word.WdWindowState.wdWindowStateMinimize;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.Documents.Open(ref FilePath, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown, ref Unknown);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> object format = Word.WdSaveFormat.wdFormatHTML;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.ActiveDocument.SaveAs(ref SaveTarget, ref format,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown, ref Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> ref Unknown, ref Unknown);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> catch (Exception e)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> finally</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> if (MSWord != null)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.Documents.Close(ref Unknown, ref Unknown, ref Unknown);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSWord.Quit(ref Unknown, ref Unknown, ref Unknown);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">}</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
This method is used to convert ExcelDocument to HTML :
</div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">public void ConvertExcelToHTML(string Source, string Target)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">{</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> if (MSExcel == null) </span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel = new Excel.ApplicationClass();</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.Visible = false;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.Application.Visible = false;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.WindowState = Excel.XlWindowState.xlMinimized;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.Workbooks.Open(Source, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Unknown, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Unknown, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Unknown, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Unknown, Unknown, Unknown);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> object format = Excel.XlFileFormat.xlHtml;</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.Workbooks[1].SaveAs(Target, format,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Unknown, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Excel.XlSaveAsAccessMode.xlExclusive, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown, Unknown, Unknown,</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> Unknown);</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> catch (Exception e)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> finally</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> if (MSExcel != null)</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.Workbooks.Close();</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> MSExcel.Quit();</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="font-size: x-small;">}</span></div>
<br />
5) Here in my example i have taken fileupload to upload word and excel documents, after selecting a file by clicking View button we can view the output just like this :<br />
<br />
Output for WordDocument :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy7rMlVsi3XnYwUpXkm-QYPfb63dpnJh8Hcxe6xICC8MM5coYOvJ3kQV_CMTVTVUcdb_AtDkMbzd8BjxOGQy628k-X_fU3mFuGpM9cnM2oeGVjPLvuMwyvTlQGA2mkXXYxzww5Pn0V0w/s1600/doc1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy7rMlVsi3XnYwUpXkm-QYPfb63dpnJh8Hcxe6xICC8MM5coYOvJ3kQV_CMTVTVUcdb_AtDkMbzd8BjxOGQy628k-X_fU3mFuGpM9cnM2oeGVjPLvuMwyvTlQGA2mkXXYxzww5Pn0V0w/s320/doc1.JPG" height="320" width="215" /></a></div>
<br />
<br />
Output for ExcelDocument :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf-mfojqbx6WM2dqcFCnZsbMADysghSyLkEjQbfjTZJ8t3l60UM0S0B2ofEZYDtEJyYJiZ6BMC_ESx_y0agoygapJcfam2mT5uoVgYVP308LbBf29XQs89RQyai2evSo6VUG4uXRRv6g/s1600/excelop.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf-mfojqbx6WM2dqcFCnZsbMADysghSyLkEjQbfjTZJ8t3l60UM0S0B2ofEZYDtEJyYJiZ6BMC_ESx_y0agoygapJcfam2mT5uoVgYVP308LbBf29XQs89RQyai2evSo6VUG4uXRRv6g/s320/excelop.JPG" height="276" width="320" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com7tag:blogger.com,1999:blog-7268354074930145165.post-16673671903635438572012-05-25T15:30:00.003+05:302014-07-17T14:22:07.456+05:30Word document in iframe<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
This is screen shot for iframe.Here In the below Screenshot iframe viewing the word document in the form of html. so i am giving html to the Iframe src.</div>
<div class="separator" style="clear: both; text-align: left;">
Iframe can view excel,csv,pdf,text files etc.Pdf and Text formated files no need to be converted to html directly we can give src for that files.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHIMc_qf9hJBW2ZHtivd48KYCICW80VoiKqO5GERnb1a7aSvGi94ZLF8d6rLNNQHRfdt7SwhUi-TBw8qF9CI2cqPB6_q5DuNtCA5s3Uno6skypBtneElyxqjrjXY6U3AMtkDhps6jv4A/s1600/IFramePic.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHIMc_qf9hJBW2ZHtivd48KYCICW80VoiKqO5GERnb1a7aSvGi94ZLF8d6rLNNQHRfdt7SwhUi-TBw8qF9CI2cqPB6_q5DuNtCA5s3Uno6skypBtneElyxqjrjXY6U3AMtkDhps6jv4A/s400/IFramePic.JPG" height="190" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Click below link to get full Example :<br />
<br />
<a href="http://yash-maneel.blogspot.in/2012/05/word-documents-and-excel-documents-in.html" rel="nofollow" target="_blank">http://yash-maneel.blogspot.in/2012/05/word-documents-and-excel-documents-in.html</a></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com1tag:blogger.com,1999:blog-7268354074930145165.post-45343404937038342522012-05-23T19:54:00.000+05:302014-07-17T14:22:15.195+05:30Culture info in RadDateTime Picker<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
In this example we can give culture info for localization in RadDatetimePicker.<br />
<br />
for this below example u can get different localizations according to their country.<br />
<br />
it is one of the property in RadDateTimePicker<br />
<br />
for different localization we can find below link:<br />
<a href="http://yash-maneel.blogspot.in/2012/05/different-culture-names.html">http://yash-maneel.blogspot.in/2012/05/different-culture-names.html</a>
<br />
<br />
<h4 style="text-align: left;">
<u>In aspx Page</u></h4>
<br />
<telerik:RadDatePicker ID="RadDatePicker1" runat="server"><br />
<Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"<br />
ViewSelectorText="x" FastNavigationSettings-EnableTodayButtonSelection="true"<br />
<span style="background-color: #f9cb9c;">CultureInfo="Arabic (Iraq)"</span>><br />
</Calendar><br />
</telerik:RadDatePicker><br />
<br />
<h4 style="text-align: left;">
Note: can change culture info according to your requirements</h4>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmrrWgC2aoisW6JcG-cZ_i7w079OyTx0bSRWhGqIkvloZcpRk_sKc487oXbm6NIGXzsFVAQ74H46tg20x4G2bxBS39Ie4TxD4X9B59_SyxshvM2fazdUt1u6r4Vn1SLSuweDYv6PCVxQ/s1600/Capture.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmrrWgC2aoisW6JcG-cZ_i7w079OyTx0bSRWhGqIkvloZcpRk_sKc487oXbm6NIGXzsFVAQ74H46tg20x4G2bxBS39Ie4TxD4X9B59_SyxshvM2fazdUt1u6r4Vn1SLSuweDYv6PCVxQ/s400/Capture.JPG" height="171" width="400" /></a></div>
<h4 style="text-align: left;">
Final OutPut:</h4>
<div>
<br /></div>
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-72906619744584210292012-05-23T18:52:00.000+05:302014-07-17T14:22:46.283+05:30Different Culture Names<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white;"><br /></span>
<pre class="code" style="font-family: 'Courier New', Courier, Consolas, monospace; font-size: 12px; line-height: 19px; overflow-x: auto; width: 599px;"><span style="background-color: white;">CULTURE ||SPEC.CULTURE||ENGLISH NAME
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
ar-IQ ar-IQ Arabic (Iraq)
ar-JO ar-JO Arabic (Jordan)
ar-KW ar-KW Arabic (Kuwait)
ar-LB ar-LB Arabic (Lebanon)
ar-LY ar-LY Arabic (Libya)
ar-MA ar-MA Arabic (Morocco)
ar-OM ar-OM Arabic (Oman)
ar-QA ar-QA Arabic (Qatar)
ar-SA ar-SA Arabic (Saudi Arabia)
ar-SY ar-SY Arabic (Syria)
ar-TN ar-TN Arabic (Tunisia)
ar-YE ar-YE Arabic (Yemen)
az az-Latn-AZ Azeri
az-Cyrl-AZ az-Cyrl-AZ Azeri (Cyrillic, Azerbaijan)
az-Latn-AZ az-Latn-AZ Azeri (Latin, Azerbaijan)
be be-BY Belarusian
be-BY be-BY Belarusian (Belarus)
bg bg-BG Bulgarian
bg-BG bg-BG Bulgarian (Bulgaria)
bs-Latn-BA bs-Latn-BA Bosnian (Bosnia and Herzegovina)
ca ca-ES Catalan
ca-ES ca-ES Catalan (Catalan)
cs cs-CZ Czech
cs-CZ cs-CZ Czech (Czech Republic)
cy-GB cy-GB Welsh (United Kingdom)
da da-DK Danish
da-DK da-DK Danish (Denmark)
de de-DE German
de-AT de-AT German (Austria)
de-DE de-DE German (Germany)
de-CH de-CH German (Switzerland)
de-LI de-LI German (Liechtenstein)
de-LU de-LU German (Luxembourg)
dv dv-MV Divehi
dv-MV dv-MV Divehi (Maldives)
el el-GR Greek
el-GR el-GR Greek (Greece)
en en-US English
en-029 en-029 English (Caribbean)
en-AU en-AU English (Australia)
en-BZ en-BZ English (Belize)
en-CA en-CA English (Canada)
en-GB en-GB English (United Kingdom)
en-IE en-IE English (Ireland)
en-JM en-JM English (Jamaica)
en-NZ en-NZ English (New Zealand)
en-PH en-PH English (Republic of the Philippines)
en-TT en-TT English (Trinidad and Tobago)
en-US en-US English (United States)
en-ZA en-ZA English (South Africa)
en-ZW en-ZW English (Zimbabwe)
es es-ES Spanish
es-AR es-AR Spanish (Argentina)
es-BO es-BO Spanish (Bolivia)
es-CL es-CL Spanish (Chile)
es-CO es-CO Spanish (Colombia)
es-CR es-CR Spanish (Costa Rica)
es-DO es-DO Spanish (Dominican Republic)
es-EC es-EC Spanish (Ecuador)
es-ES es-ES Spanish (Spain)
es-GT es-GT Spanish (Guatemala)
es-HN es-HN Spanish (Honduras)
es-MX es-MX Spanish (Mexico)
es-NI es-NI Spanish (Nicaragua)
es-PA es-PA Spanish (Panama)
es-PE es-PE Spanish (Peru)
es-PR es-PR Spanish (Puerto Rico)
es-PY es-PY Spanish (Paraguay)
es-SV es-SV Spanish (El Salvador)
es-UY es-UY Spanish (Uruguay)
es-VE es-VE Spanish (Venezuela)
et et-EE Estonian
et-EE et-EE Estonian (Estonia)
eu eu-ES Basque
eu-ES eu-ES Basque (Basque)
fa fa-IR Persian
fa-IR fa-IR Persian (Iran)
fi fi-FI Finnish
fi-FI fi-FI Finnish (Finland)
fo fo-FO Faroese
fo-FO fo-FO Faroese (Faroe Islands)
fr fr-FR French
fr-BE fr-BE French (Belgium)
fr-CA fr-CA French (Canada)
fr-FR fr-FR French (France)
fr-CH fr-CH French (Switzerland)
fr-LU fr-LU French (Luxembourg)
fr-MC fr-MC French (Principality of Monaco)
gl gl-ES Galician
gl-ES gl-ES Galician (Galician)
gu gu-IN Gujarati
gu-IN gu-IN Gujarati (India)
he he-IL Hebrew
he-IL he-IL Hebrew (Israel)
hi hi-IN Hindi
hi-IN hi-IN Hindi (India)
hr hr-HR Croatian
hr-BA hr-BA Croatian (Bosnia and Herzegovina)
hr-HR hr-HR Croatian (Croatia)
hu hu-HU Hungarian
hu-HU hu-HU Hungarian (Hungary)
hy hy-AM Armenian
hy-AM hy-AM Armenian (Armenia)
id id-ID Indonesian
id-ID id-ID Indonesian (Indonesia)
is is-IS Icelandic
is-IS is-IS Icelandic (Iceland)
it it-IT Italian
it-CH it-CH Italian (Switzerland)
it-IT it-IT Italian (Italy)
ja ja-JP Japanese
ja-JP ja-JP Japanese (Japan)
ka ka-GE Georgian
ka-GE ka-GE Georgian (Georgia)
kk kk-KZ Kazakh
kk-KZ kk-KZ Kazakh (Kazakhstan)
kn kn-IN Kannada
kn-IN kn-IN Kannada (India)
ko ko-KR Korean
kok kok-IN Konkani
kok-IN kok-IN Konkani (India)
ko-KR ko-KR Korean (Korea)
ky ky-KG Kyrgyz
ky-KG ky-KG Kyrgyz (Kyrgyzstan)
lt lt-LT Lithuanian
lt-LT lt-LT Lithuanian (Lithuania)
lv lv-LV Latvian
lv-LV lv-LV Latvian (Latvia)
mi-NZ mi-NZ Maori (New Zealand)
mk mk-MK Macedonian
mk-MK mk-MK Macedonian (Former Yugoslav Republic of Macedonia)
mn mn-MN Mongolian
mn-MN mn-MN Mongolian (Cyrillic, Mongolia)
mr mr-IN Marathi
mr-IN mr-IN Marathi (India)
ms ms-MY Malay
ms-BN ms-BN Malay (Brunei Darussalam)
ms-MY ms-MY Malay (Malaysia)
mt-MT mt-MT Maltese (Malta)
nb-NO nb-NO Norwegian, Bokmal (Norway)
nl nl-NL Dutch
nl-BE nl-BE Dutch (Belgium)
nl-NL nl-NL Dutch (Netherlands)
nn-NO nn-NO Norwegian, Nynorsk (Norway)
no nb-NO Norwegian
ns-ZA ns-ZA Northern Sotho (South Africa)
pa pa-IN Punjabi
pa-IN pa-IN Punjabi (India)
pl pl-PL Polish
pl-PL pl-PL Polish (Poland)
pt pt-BR Portuguese
pt-BR pt-BR Portuguese (Brazil)
pt-PT pt-PT Portuguese (Portugal)
quz-BO quz-BO Quechua (Bolivia)
quz-EC quz-EC Quechua (Ecuador)
quz-PE quz-PE Quechua (Peru)
ro ro-RO Romanian
ro-RO ro-RO Romanian (Romania)
ru ru-RU Russian
ru-RU ru-RU Russian (Russia)
sa sa-IN Sanskrit
sa-IN sa-IN Sanskrit (India)
se-FI se-FI Sami (Northern) (Finland)
se-NO se-NO Sami (Northern) (Norway)
se-SE se-SE Sami (Northern) (Sweden)
sk sk-SK Slovak
sk-SK sk-SK Slovak (Slovakia)
sl sl-SI Slovenian
sl-SI sl-SI Slovenian (Slovenia)
sma-NO sma-NO Sami (Southern) (Norway)
sma-SE sma-SE Sami (Southern) (Sweden)
smj-NO smj-NO Sami (Lule) (Norway)
smj-SE smj-SE Sami (Lule) (Sweden)
smn-FI smn-FI Sami (Inari) (Finland)
sms-FI sms-FI Sami (Skolt) (Finland)
sq sq-AL Albanian
sq-AL sq-AL Albanian (Albania)
sr sr-Latn-CS Serbian
sr-Cyrl-BA sr-Cyrl-BA Serbian (Cyrillic) (Bosnia and Herzegovina)
sr-Cyrl-CS sr-Cyrl-CS Serbian (Cyrillic, Serbia)
sr-Latn-BA sr-Latn-BA Serbian (Latin) (Bosnia and Herzegovina)
sr-Latn-CS sr-Latn-CS Serbian (Latin, Serbia)
sv sv-SE Swedish
sv-FI sv-FI Swedish (Finland)
sv-SE sv-SE Swedish (Sweden)
sw sw-KE Kiswahili
sw-KE sw-KE Kiswahili (Kenya)
syr syr-SY Syriac
syr-SY syr-SY Syriac (Syria)
ta ta-IN Tamil
ta-IN ta-IN Tamil (India)
te te-IN Telugu
te-IN te-IN Telugu (India)
th th-TH Thai
th-TH th-TH Thai (Thailand)
tn-ZA tn-ZA Tswana (South Africa)
tr tr-TR Turkish
tr-TR tr-TR Turkish (Turkey)
tt tt-RU Tatar
tt-RU tt-RU Tatar (Russia)
uk uk-UA Ukrainian
uk-UA uk-UA Ukrainian (Ukraine)
ur ur-PK Urdu
ur-PK ur-PK Urdu (Islamic Republic of Pakistan)
uz uz-Latn-UZ Uzbek
uz-Cyrl-UZ uz-Cyrl-UZ Uzbek (Cyrillic, Uzbekistan)
uz-Latn-UZ uz-Latn-UZ Uzbek (Latin, Uzbekistan)
vi vi-VN Vietnamese
vi-VN vi-VN Vietnamese (Vietnam)
xh-ZA xh-ZA Xhosa (South Africa)
zh-CN zh-CN Chinese (People's Republic of China)
zh-HK zh-HK Chinese (Hong Kong S.A.R.)
zh-CHS (none) Chinese (Simplified)
zh-CHT (none) Chinese (Traditional)
zh-MO zh-MO Chinese (Macao S.A.R.)
zh-SG zh-SG Chinese (Singapore)
zh-TW zh-TW Chinese (Taiwan)
zu-ZA zu-ZA Zulu (South Africa)</span></pre>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-42551264701176163152012-05-23T15:05:00.001+05:302014-07-17T14:22:54.141+05:30Convert date format in javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Here in this example i am going to explain how to convert date into another format in javascript.<br />
<br />
Example :<br />
<br />
Here in this today's date will be obtained in the variable dt in system format and on TodayDate variable we will get the date in required format. The example formats are:<br />
var dt = new Date();<br />
var TodayDate = dt.format("M/d/yyyy");<br />
var TodayDate = dt.format("M/d/yy");
<br />
var TodayDate = dt.format("MM/dd/yy");
<br />
var TodayDate = dt.format("yy/MM/dd");
<br />
var TodayDate = dt.format("yyyy-MM-dd");
<br />
var TodayDate = dt.format("dd-MMM-yy");
<br />
var TodayDate = dt.format("MM/dd/yyyy");
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com1tag:blogger.com,1999:blog-7268354074930145165.post-57244169089090048992012-05-19T18:28:00.000+05:302014-07-17T14:23:03.199+05:30show processing image when click on button and freeze background in asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
This post gives some useful information to beginner's those don't know to design the page.<br />
here i am just blocking the background screen to stop clicking any buttons or controls in the page. so with this u can click on particular button to freeze the screen<br />
<br />
<br />
<h4>
Example : </h4>
<br />
<div style="text-align: left;">
in the following example i am taking one registration form to show the processing<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrUCJxqYS_bEC71pQDl0DeID17lxIkJr0QnFJUMROZfD9thhyphenhyphenNQzo62HerwSub800dRXU4XePKSv_7StG6m0d0xbkirvd02LARX6hc983WxkQPyXaQ07n2n4e9qZrnssu3Mjf4gfggGA/s1600/Lpic1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrUCJxqYS_bEC71pQDl0DeID17lxIkJr0QnFJUMROZfD9thhyphenhyphenNQzo62HerwSub800dRXU4XePKSv_7StG6m0d0xbkirvd02LARX6hc983WxkQPyXaQ07n2n4e9qZrnssu3Mjf4gfggGA/s400/Lpic1.JPG" height="378" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
after filling all the required fields click on the save button it will take some time to inseret the fields in database. in the meanwhile user should not click on any buttons or controls for that u can do the following design or logic.... </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h4 style="text-align: left;">
In aspx Page:</h4>
<div class="separator" style="clear: both; text-align: left;">
<body></div>
<div class="separator" style="clear: both;">
<form id="form1" runat="server"></div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
<asp:ScriptManager ID="ScriptManager1" runat="server"></div>
<div class="separator" style="clear: both;">
</asp:ScriptManager></div>
<div class="separator" style="clear: both;">
<div></div>
<div class="separator" style="clear: both;">
<div style="background-color: Transparent; color: Black"></div>
<div class="separator" style="clear: both;">
<span style="color: red;"><asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2"</span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> DisplayAfter="0"></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <ProgressTemplate></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <div style="top: 0px; height: 100%; background-color: White; opacity: 2.75; filter: alpha(opacity=75);</span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> vertical-align: middle; left: 0px; z-index: 999999; width: 100%; position: absolute;</span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> text-align: center; vertical-align: middle"></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <table width="100%" height="100%"></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <tr></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <td align="center" valign="middle"></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <img id="Img1" src="Processing.gif" runat="server" /></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </td></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </tr></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </table></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </div></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </ProgressTemplate></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </asp:UpdateProgress></span></div>
<div class="separator" style="clear: both;">
</div></div>
<div class="separator" style="clear: both;">
<table width="100%"></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td valign="middle" align="center" style="padding: 50px;"></div>
<div class="separator" style="clear: both;">
<table width="500px" style="height: 500px; background-color: #b4cfe4;"></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="100%" valign="bottom" style="padding:10px;"></div>
<div class="separator" style="clear: both;">
<span style="font-family: Times New Roman; font-weight: bold; color: Red; font-size:20px;">Please fill</div>
<div class="separator" style="clear: both;">
the following form to complete registration</span></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="100%"></div>
<div class="separator" style="clear: both;">
<table width="100%"></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblFirstName" runat="server" Text="FirstName :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtFName" runat="server"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblLastName" runat="server" Text="LastName :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtLName" runat="server"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblCity" runat="server" Text="City :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="textCity" runat="server"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblState" runat="server" Text="State :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtState" runat="server"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblPhone" runat="server" Text="PhoneNumber :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblEmail" runat="server" Text="EMailID :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblpwd" runat="server" Text="Password :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtpwd" runat="server" TextMode="Password"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="40%" align="right" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:Label ID="lblcpwd" runat="server" Text="ConfirmPassword :"></div>
<div class="separator" style="clear: both;">
</asp:Label></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
<td width="60%" align="left" style="padding: 5px;"></div>
<div class="separator" style="clear: both;">
<asp:TextBox ID="txtcpwd" runat="server" TextMode="Password"></asp:TextBox></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
</table></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
<tr></div>
<div class="separator" style="clear: both;">
<td width="100%" align="right" style="padding-bottom: 50px; padding-right:15px;"></div>
<div class="separator" style="clear: both;">
<span style="color: red;"><asp:UpdatePanel ID="UpdatePanel2" runat="server"></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <ContentTemplate></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <asp:Button ID="btnSave" Width="100px" runat="server" OnClick="lnkbtnSave_Click"</span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> Text="Save" /></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <asp:Button ID="btnCancel" Width="100px" runat="server" </span><span style="color: red;">Text="Cancel" /></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </ContentTemplate></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <Triggers></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" /></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </Triggers></span></div>
<div class="separator" style="clear: both;">
<span style="color: red;"> </asp:UpdatePanel></span></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
</table></div>
<div class="separator" style="clear: both;">
</td></div>
<div class="separator" style="clear: both;">
</tr></div>
<div class="separator" style="clear: both;">
</table></div>
<div class="separator" style="clear: both;">
</div></div>
<div class="separator" style="clear: both;">
</form></div>
<div class="separator" style="clear: both;">
</body></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
So when u click on save button the scrren will be freezed (upto finish the code written in button click) and it will come back to normal</div>
<div class="separator" style="clear: both;">
</div>
<h4>
Final Output:</h4>
<br />
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn-PiVG5LsrCfx6bsCncnOEQSsQvkaH3Jq7HPNarh-65zSHC_UJ0KCJ6tS3LEbDpNFdEngs138LXW45wZoDUUbapYgyIcjAEzhdol0ZmLPo6MRTO8qpE6MGyLK33FdmBJb1tqRebQkAg/s1600/Lpic2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn-PiVG5LsrCfx6bsCncnOEQSsQvkaH3Jq7HPNarh-65zSHC_UJ0KCJ6tS3LEbDpNFdEngs138LXW45wZoDUUbapYgyIcjAEzhdol0ZmLPo6MRTO8qpE6MGyLK33FdmBJb1tqRebQkAg/s400/Lpic2.JPG" height="372" width="400" /></a></div>
<h4 style="text-align: left;">
</h4>
<br />
<div class="separator" style="clear: both; text-align: left;">
Note : 1) To work with this example should place 'script manager ' in the form</div>
<div class="separator" style="clear: both; text-align: left;">
2) No need to write any code for processing image in cs page(u can write ur logic such as insert,update or etc....)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Thank U</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com1tag:blogger.com,1999:blog-7268354074930145165.post-82968029997262427702012-05-16T14:23:00.001+05:302014-07-17T14:23:11.778+05:30Increase Performance in asp.net application<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: center;">
<span style="text-align: left;">It is very usefull for begineers...............</span></h2>
<h4 style="text-align: left;">
For every enterprise level application the key to make that application success is the responsiveness of application. ASP.NET also offers great deal of the features for developing web based enterprise application but sometimes due to avoiding best practice to write application the performance of application performance of application is not so fast as it should be. Here is the some use full suggestion to make your application super fast.</h4>
1. Always set debug=”false” in web.config production environment.<br />
<br />
2. Always set trace=”false” in web.config production environment<br />
<br />
3. If you are using asp.net 2.0 or higher version then always use precompiled version of your code and also prefer web application project over website. If you are using website then always publish it and then upload that precompiled version of your site in production environment.<br />
<br />
4. Always compile your project in Release Mode before uploading application to production environment.<br />
<br />
5. Decrease your html kb as much as you can for that use tables less html using div’s and if possible then do not give big name to your control it will increase your html kb as asp.net uses client Id to differentiate all the controls. If you are creating custom controls then you can overwrite your clientid and uniqueId.<br />
<br />
6. Use cache api as much as possible it will decrease your server roundtrip and boost application performance. ASP.NET 2.0 or higher version provides functionality called sqlcachedependancy for your database caching. It will validate cache with your database operation like insert, update and delete and if not possible with it then use the file base caching.<br />
<br />
7. Remove blank spaces from your html it will increase your kb. You can use regular expression to remove white spaces. I will post the code for removing white spaces next posts.<br />
<br />
8. For asp.net 2.0 and higher version use master pages. It will increase your performance.<br />
<br />
9. Prefer database reader over dataset unless and until you have specific reason to use database.<br />
<br />
10. Use ADO.NET asynchronous calls for ado.net methods. asp.net 2.0 or higher version is supporting your performance. If you are using same procedure or command multiple time then use ADO.NET Prepare command it will increase your performance.<br />
<br />
11. Do IIS performance tuning as per your requirement.<br />
<br />
12. Disable view state for your controls if possible. If you are using asp.net 2.0 or higher version then use asp.net control state instead of view state. Store view state in session or database by overriding the default methods for storing view state.<br />
<br />
13. User Server.Transfer instead of response.redirect.<br />
<br />
14. Always use inproc session state if possible.<br />
<br />
15. Use Ajax for your application wisely. Lots of Ajax calls for a page will also decrease your performance.<br />
<br />
16. Measure your application performance with tools like redgate profiler, firebug and whyslow from yahoo.<br />
<br />
17. User System.Text.StringBuilder for string concatenation its 4 times more faster then the normal strings.<br />
<br />
18. Right JavaScript in .Js files and place it as bottom of the application.<br />
<br />
19. Use Separate CSS files for styling of application.<br />
<br />
20. User database paging over normal paging while displaying huge amount of data.<br />
<br />
21. Call web service from java script instead of server side. Use asynchronous calls to call a web method from web service.<br />
<br />
soon we will give suitable Examples for each point......................................<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-62731806223164850672012-05-14T14:09:00.000+05:302014-07-17T14:23:21.811+05:30uploading file in rad upload and validating file size using java script or validating uploaded file size from client side<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="text-align: left;">
description:</h4>
<div>
This Article is useful to all beginners as well as who suffering to get uploading file size in client side using java script</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
So,here just i am using RAD ASYNCHRONOUS Upload control to validate the file size .</div>
<div>
<br /></div>
<div>
here we are not writing single word in code behind ..everything will work only from design page itself</div>
<div>
<br /></div>
<div>
The page will have following content :</div>
<div>
<br />
This namespace for ""Telerik"" to access the telerik controls in aspx page :</div>
<div>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<br />
<br />
RadScriptManager is a control that replaces the script manager available in the Microsoft Ajax Extensions suite. On this radscriptmanager the three script references is need to get added to get the filesize while file uploading in progress.<br />
<br />
<br />
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></div>
<div>
<Scripts></div>
<div>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /></div>
<div>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /></div>
<div>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /></div>
<div>
</Scripts></div>
<div>
</telerik:RadScriptManager></div>
<br />
Note : To get the additional features in javascript we need to add the above mentioned three references in radscriptmanager.<br />
<br />
<div style="text-align: left;">
<b style="background-color: white; font-family: Arial, sans-serif; font-size: 12px; line-height: 19px;">RadCodeBlock</b><span style="background-color: white; font-family: Arial, sans-serif; font-size: 12px; line-height: 19px;"> should be used when you have server code blocks placed within the markup (most often some JavaScript functions accessing server controls).</span><b style="background-color: white; font-family: Arial, sans-serif; font-size: 12px; line-height: 19px;">RadCodeBlock</b><span style="background-color: white; font-family: Arial, sans-serif; font-size: 12px; line-height: 19px;"> is used to isolate the code block preventing the error from appearing.</span></div>
<div style="text-align: left;">
<span style="background-color: white; font-family: Arial, sans-serif; font-size: 12px; line-height: 19px;">For radasynchronous upload we have given the clientside events :</span></div>
<div style="text-align: left;">
1)OnClientProgressUpdating.</div>
<div style="text-align: left;">
2)OnClientFileUploaded.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
OnClientProgressUpdating we will get the Uploading file size. This obtained file size will be maintained in the global declared variable. After on OnClientFileUploaded event we will check whether the file size limit is exceeded or not. If it is exceeded the maximum limit(Here for the convenience i have taken 2MB as maximum limit you can change it as per your requirement) we will remove the file.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Note : The maximum file size limit will be checked in the form of bytes(Here 2MB=2097152bytes).</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="background-color: white; font-family: Arial, sans-serif; font-size: 12px; line-height: 19px;"><br /></span></div>
</div>
<h4 style="text-align: left;">
.aspx page:</h4>
<div>
<div>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileSizeRadUpload.aspx.cs"</div>
<div>
Inherits="RadUpload.FileSizeRadUpload" %></div>
<div>
<br /></div>
<div>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %></div>
<div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></div>
<div>
<html xmlns="http://www.w3.org/1999/xhtml"></div>
<div>
<head runat="server"></div>
<div>
<title></title></div>
<div>
</head></div>
<div>
<body></div>
<div>
<form id="form1" runat="server"></div>
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></div>
<div>
<Scripts></div>
<div>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /></div>
<div>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /></div>
<div>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /></div>
<div>
</Scripts></div>
<div>
</telerik:RadScriptManager></div>
<div>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"></div>
<div>
<br /></div>
<div>
<script type="text/javascript"></div>
<div>
<br /></div>
<div>
var UploadedFileSize = 0; </div>
<div>
function OnProgressUpdating(sender, args) {</div>
<div>
UploadedFileSize = args.get_data().fileSize;</div>
<div>
}</div>
<div>
function OnFileUploaded(sender, args) {</div>
<div>
alert(UploadedFileSize);</div>
<div>
if(UploadedFileSize > 2097152)</div>
<div>
var numberOfFiles = sender._uploadedFiles.length;</div>
<div>
sender.deleteFileInputAt(numberOfFiles - 1);</div>
<div>
}</div>
<div>
</div>
<div>
</script></div>
<div>
<br /></div>
<div>
</telerik:RadCodeBlock></div>
<div>
<div></div>
<div>
<telerik:RadAsyncUpload ID="RadAsyncUpload1" OnClientProgressUpdating="OnProgressUpdating"</div>
<div>
OnClientFileUploaded="OnFileUploaded" runat="server" EnableFileInputSkinning="false"></div>
<div>
</telerik:RadAsyncUpload></div>
<div>
</div></div>
<div>
</form></div>
<div>
</body></div>
<div>
</html></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-31546115038061449202012-05-12T08:16:00.001+05:302014-07-17T14:23:31.415+05:30Copy only numbers from textbox using javascript<div dir="ltr" style="text-align: left;" trbidi="on">
In this Example i am Describing , Copy only numbers or numeric characters in the text box..<br />
here if we copy characters + numbers it will copy only Numbers<br />
<br />
Here is the Example :<br />
<br />
1)Copy data from Textbox :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvcZh2GYATwcOT8u1uphC-sgPU1sMSnWCILltau2-XI45k5FvqkpUFwsP4NsHoU09wiNgsu1tsTtiDad6MRLHVeei7YlW6hvId3Ec9Kshr0reVCaNDam3iU8WViffeSDGkocIHUPJ3Hw/s1600/pic1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvcZh2GYATwcOT8u1uphC-sgPU1sMSnWCILltau2-XI45k5FvqkpUFwsP4NsHoU09wiNgsu1tsTtiDad6MRLHVeei7YlW6hvId3Ec9Kshr0reVCaNDam3iU8WViffeSDGkocIHUPJ3Hw/s320/pic1.PNG" height="188" width="320" /></a></div>
<br />
<br />
<br />
2) Paste in another Textbox :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO0Bx6xs6IWroAq9I4JKP1AY8IogLeTImLzQG3fvXCAio_KUy__uGLNxI_Ek2uKVoFZk8BaGSLAS7JWS1Z2yDk1lKmuA_VBn9_rfPFJJhb2dulnnpoI60JsLkvbOWLt_gGt0YyFt5TpQ/s1600/pic2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO0Bx6xs6IWroAq9I4JKP1AY8IogLeTImLzQG3fvXCAio_KUy__uGLNxI_Ek2uKVoFZk8BaGSLAS7JWS1Z2yDk1lKmuA_VBn9_rfPFJJhb2dulnnpoI60JsLkvbOWLt_gGt0YyFt5TpQ/s400/pic2.PNG" height="196" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
3) Final OUTPUT :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3IvbC7gaN_plHuASVCjl2KHphwjF4ir7G9FSvcaFm8cq4NbzLbbXoZngzEsCVijmJ-X-vuZO2q9Gr3iZ3A55RvNWPKZPqL7HKfu-LNXKfyubNn1ne34WtA-Y5rNCPp1jEplUI-LxyCQ/s1600/pic3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3IvbC7gaN_plHuASVCjl2KHphwjF4ir7G9FSvcaFm8cq4NbzLbbXoZngzEsCVijmJ-X-vuZO2q9Gr3iZ3A55RvNWPKZPqL7HKfu-LNXKfyubNn1ne34WtA-Y5rNCPp1jEplUI-LxyCQ/s320/pic3.PNG" height="32" width="320" /></a></div>
<br />
<br />
<u>TextBox oncopy :</u><br />
<br />
oncopy="return CopyNumericOnly(this);"<br />
<br />
<u>Script :</u><br />
<u><br /></u>
function CopyNumericOnly(obj) {<br />
var textboxvalue = obj.value;<br />
var strValidChars = "0123456789";<br />
var strChar;<br />
var FilteredChars = "";<br />
for (d = 0; d < textboxvalue.length; d++) {<br />
strChar = textboxvalue.charAt(d);<br />
if (strValidChars.indexOf(strChar) != -1) {<br />
FilteredChars = FilteredChars + strChar;<br />
}<br />
}<br />
window.clipboardData.setData('Text', FilteredChars);<br />
return false;<br />
}<u><br /></u><br />
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com2tag:blogger.com,1999:blog-7268354074930145165.post-53704009723541399372012-05-09T13:55:00.001+05:302014-07-17T14:23:40.181+05:30Rad Date Time Picker With Today Button<div dir="ltr" style="text-align: left;" trbidi="on">
Generally We use calender control to pick a particular day month and year to avoid typing.<br />
But in rad date picker we don't find today button in calender..(in rad date picker default today button will appear in second click)<br />
so to avoid more clicks i am attaching following code<br />
<br />
Ex:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglwFL1AWAMYGq8y4pluBtawg7kvIcC-iN0WIxnmk4JbFdBzxFwmvSiAkpu0LvRlvUCQkK10k_DludrpPdCiwZQitebZkyPVRfUhXgnFPC1SW6W7d0rsT3XopfQ-g9uSX8LMoD_YyyFWA/s1600/Calender1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglwFL1AWAMYGq8y4pluBtawg7kvIcC-iN0WIxnmk4JbFdBzxFwmvSiAkpu0LvRlvUCQkK10k_DludrpPdCiwZQitebZkyPVRfUhXgnFPC1SW6W7d0rsT3XopfQ-g9uSX8LMoD_YyyFWA/s1600/Calender1.JPG" /></a></div>
<br />
<br />
there is no code for this example just we have to set some properties as follows<br />
<br />
IN .aspx Page<br />
---------------<br />
<br />
<br />
<telerik:RadDateTimePicker ID="rdpDateReq" runat="server"><br />
<Calendar runat="server" ><br />
<FooterTemplate><br />
<div style="width: 100%; text-align: center; background-color: Gray;"><br />
<input id="Button1" type="button" value="Today" onclick="GoToToday();" /><br />
</div><br />
</FooterTemplate><br />
</Calendar><br />
<TimeView CellSpacing="-1" Culture="English (United States)" runat="server"><br />
</TimeView><br />
</telerik:RadDateTimePicker><br />
<br />
to display calender image we need to click small calender ICON and then it will display according to their skin . so here for today button do the following steps (or) copy the code i displayed above<br />
1)Add footer in calender control.<br />
2)Add Div with style (Back Color for footer and button Type and settings)<br />
3)with in the div Add one html button to avoid post back<br />
4)Add JavaScript function to the button(it is displayed in the below of these steps)<br />
5)Now u can see the today's date in rad date picker's text box<br />
<br />
<br />
<br />
<br />
<script type="text/javascript"><br />
function GoToToday() {<br />
var datepicker = $find("<%=rdpDateReq.ClientID%>");<br />
var dt = new Date();<br />
datepicker.set_selectedDate(dt);<br />
datepicker.hidePopup();<br />
}<br />
</script><br />
<br />
<br />
OUTPUT:<br />
-----------<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHisUM6VoZ_HAYQYReUfAfMihGeSr3YAhuHj3E_XefGHqlNnaCUjcr1jBQnFRdwWV2x-5UjF9Jz3nSi6ZD-sSb4vl9mhJeNfnSU3vDYG_wrVvLXCYyxP0EMobZQfA-4GSAiybOSKb15Q/s1600/Cal.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHisUM6VoZ_HAYQYReUfAfMihGeSr3YAhuHj3E_XefGHqlNnaCUjcr1jBQnFRdwWV2x-5UjF9Jz3nSi6ZD-sSb4vl9mhJeNfnSU3vDYG_wrVvLXCYyxP0EMobZQfA-4GSAiybOSKb15Q/s1600/Cal.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglwFL1AWAMYGq8y4pluBtawg7kvIcC-iN0WIxnmk4JbFdBzxFwmvSiAkpu0LvRlvUCQkK10k_DludrpPdCiwZQitebZkyPVRfUhXgnFPC1SW6W7d0rsT3XopfQ-g9uSX8LMoD_YyyFWA/s1600/Calender1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglwFL1AWAMYGq8y4pluBtawg7kvIcC-iN0WIxnmk4JbFdBzxFwmvSiAkpu0LvRlvUCQkK10k_DludrpPdCiwZQitebZkyPVRfUhXgnFPC1SW6W7d0rsT3XopfQ-g9uSX8LMoD_YyyFWA/s1600/Calender1.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
So next time u Click on Calender icon today time will selected automatically...........</div>
<br />
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-30354594118553010092012-05-06T12:34:00.001+05:302014-07-17T14:23:47.769+05:30How to check session timeout from javascript and redirect to login page<div dir="ltr" style="text-align: left;" trbidi="on">
<u>JAVASCRIPT :</u> <br />
<br />
var sessionTimeout = <%= Session.Timeout %><br />
<br />
function DisplaySessionTimeout() {<br />
sessionTimeout = sessionTimeout - 1;<br />
window.setTimeout("DisplaySessionTimeout()", 60000);<br />
if (sessionTimeout == 0) {<br />
window.location = "../Login.aspx";<br />
}<br />
}<br />
<br />
Here the above mentioned script need to be called in the <b>PageLoad</b> of the page which works like a timer. This may be on serverside (or) clientside.<br />
<br />
<u>Server side pageload as follows :</u><br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
Page.ClientScript.RegisterStartupScript(this.GetType(), "onLoad", "DisplaySessionTimeout();",true); <br />
}<br />
<br />
<u>Client side page load as follows :</u><br />
<br />
function pageLoad()<br />
{<br />
DisplaySessionTimeout();<br />
}<br />
<br />
<u>Description :</u><br />
<br />
<%= Session.Timeout %> will get the time which we have given on "web.config".<br />
Forevery minute it will check the session time and get logged out when session get expired.<br />
<br />
Implement this script on "MasterPage" will be useful for entire application which are linked to it.<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com4tag:blogger.com,1999:blog-7268354074930145165.post-77047528656226331842012-05-03T18:57:00.002+05:302014-07-17T14:23:56.692+05:30How to get Screen bounds or dimensions in javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Generally our application may get opened in different types of monitors. For example in home pc's we used to prefer 15 (or) 17 inches monitor but in Companies and others they used to prefer big monitors in that case this code will be useful.<br />
While adjusting our application according to screen bounds and adjust our window according to screen we can set the height and width manually by getting the screen height and width like this<br />
<br />
--------------------------------------------------<br />
var Height = screen.height;<br />
var Width = screen.width;<br />
--------------------------------------------------<br />
<br />
Here in this case whatever the height and width for the screen will be known in above mentioned height and width variables and according to that we can adjust our application manually. </div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com0tag:blogger.com,1999:blog-7268354074930145165.post-81729881331160078362012-05-03T14:04:00.004+05:302014-07-17T14:24:04.320+05:30paste only numbers in text box using javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
In this Example i am Describing , Paste only numbers or numeric in the text box..<br />
here if we copying characters + numbers it will paste (display) only Numbers<br />
<br />
Here is the Example<br />
<br />
1)First Copy Any data:<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm9vuPvbtTksKAYEGzQbnIVqu2vAFoBbnx0eSzz6c92AM1Ha9y3Kjz32f9BSgQqFL2MQ0BDRkqdptw9Im4ZUYJyAf1_veP4UeqRXJQdDW2RcUILUo2QtKgCtGX0c3cMPmOfr8ekyKCig/s1600/Pic1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm9vuPvbtTksKAYEGzQbnIVqu2vAFoBbnx0eSzz6c92AM1Ha9y3Kjz32f9BSgQqFL2MQ0BDRkqdptw9Im4ZUYJyAf1_veP4UeqRXJQdDW2RcUILUo2QtKgCtGX0c3cMPmOfr8ekyKCig/s320/Pic1.JPG" height="178" width="320" /></a></div>
<br />
2)Paste in second text box<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf5bY24cae-knLrFNd2ADoGYMxrIh6Tvpd7swNbvfFicXFYcL1-F9WMivgO4I-iW7AyIadcoN0U9nCeBp74RuPHlThYcopoALrU75HMGHc9YgtnDT2FNBOr4Lt0e_2Uyhwj-F1yf-GoQ/s1600/Pic2.JPG" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf5bY24cae-knLrFNd2ADoGYMxrIh6Tvpd7swNbvfFicXFYcL1-F9WMivgO4I-iW7AyIadcoN0U9nCeBp74RuPHlThYcopoALrU75HMGHc9YgtnDT2FNBOr4Lt0e_2Uyhwj-F1yf-GoQ/s320/Pic2.JPG" height="174" width="320" /></a></div>
<br />
3)final OUTPUT:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjylm9G7YZs5lC-DBcTYk6gn6Jxg0ESItbu5QPp5tzZTXO6Q3jsmq_VwSNx3XJJ9a-QPQBgEMgA-FO4tN-456Ju7LmJRXBqVd4LlGIhporndjm4YVqQNusP6LC7xfTJTAjNRexYg9x2-g/s1600/Pic3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjylm9G7YZs5lC-DBcTYk6gn6Jxg0ESItbu5QPp5tzZTXO6Q3jsmq_VwSNx3XJJ9a-QPQBgEMgA-FO4tN-456Ju7LmJRXBqVd4LlGIhporndjm4YVqQNusP6LC7xfTJTAjNRexYg9x2-g/s400/Pic3.JPG" height="51" width="400" /></a></div>
<br />
<br />
Text box onpaste :<br />
------------<br />
onpaste="return paste(this);"<br />
<br />
Script:<br />
-------<br />
<br />
function paste(obj) {<br />
var totalCharacterCount = window.clipboardData.getData('Text');<br />
var strValidChars = "0123456789";<br />
var strChar;<br />
var FilteredChars = "";<br />
for (i = 0; i < totalCharacterCount.length; i++) {<br />
strChar = totalCharacterCount.charAt(i);<br />
if (strValidChars.indexOf(strChar) != -1) {<br />
FilteredChars = FilteredChars + strChar;<br />
}<br />
}<br />
obj.value = <span style="background-color: white;">FilteredChars;</span><br />
<span style="background-color: white;"> return false;</span><br />
}<br />
<br />
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/09912437790008780594noreply@blogger.com4