<asp:TextBox ID="TextBox1" runat="server" readonly="true" onfocus="this.blur();" ></asp:TextBox>
Wednesday, 16 October 2013
Monday, 9 September 2013
How to set the position of the ASP.NET Ajax ModalPopupExtender?
<AjaxToolkit:ModalPopupExtender
...otherproperties...
X="100" Y="300">
</AjaxToolkit:ModalPopupExtender>
Sunday, 1 September 2013
Telerik Rad Grid Nested Grouping
<MasterTableView GroupLoadMode="Client">
<GroupByExpressions>
<telerik:GridGroupByExpression
>
<GroupByFields>
<telerik:GridGroupByField FieldName="status" />
</GroupByFields>
<SelectFields>
<telerik:GridGroupByField FieldName="status" HeaderValueSeparator="" HeaderText=" " FieldAlias="status" />
</SelectFields>
</telerik:GridGroupByExpression>
<telerik:GridGroupByExpression >
<GroupByFields>
<telerik:GridGroupByField FieldName="date"
/>
</GroupByFields>
<SelectFields>
<telerik:GridGroupByField FieldName="date" HeaderValueSeparator="" HeaderText=" " FieldAlias="Test" />
</SelectFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
</MasterTableView>
Group by column in Telerik Rad grid
<MasterTableView GroupLoadMode="Client">
<GroupByExpressions>
<telerik:GridGroupByExpression
>
<GroupByFields>
<telerik:GridGroupByField FieldName="status" />
</GroupByFields>
<SelectFields>
<telerik:GridGroupByField FieldName="status" HeaderValueSeparator="" HeaderText=" " FieldAlias="status" />
</SelectFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
</MasterTableView>
Thursday, 29 August 2013
Telerik radgridview change row color based on value
protected void gvUserDetail_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item is GridDataItem)
{
//Get
the instance of the right type
GridDataItem
dataBoundItem = e.Item as GridDataItem;
//Check
the formatting condition
if
((dataBoundItem["column"].Text) ==
"Test")
{
dataBoundItem["column"].ForeColor = Color.Green;
dataBoundItem["column"].Font.Bold = true;
e.Item.BackColor = Color.Red;
//Customize
more...
}
}
}
Saturday, 3 August 2013
SQL Time Overlap/Conflict Query
select * from
table t2
where name = @name
and (@inserted_start_datetime between
start_datetime and end_datetime
or @inserted_end_datetime between
start_datetime and end_datetime
or start_datetime between
@inserted_start_datetime and
@inserted_end_datetime
or
end_datetime between @inserted_start_datetime and @inserted_end_datetime
Thursday, 27 June 2013
sql round arithmetic overflow error converting expression to data type numeric
SELECT Round(1*99.99,0) . it will work in Sql 2008
Thursday, 23 May 2013
Write an SQL Query to check whether date passed to Query is date of given format or not?
SQL has IsDate() function which is used to check passed
value is date or not of specified format ,it returns 1(true) or 0(false)
accordingly.
SELECT ISDATE('1/08/13') AS "MM/DD/YY";
Tuesday, 21 May 2013
Standard Date Time Format - C#
DateTime
dtDate;
string strDate;
strDate = string.Format("{0:d}", Convert.ToDateTime(dr["dtDate"]));
dtDate
= Convert.ToDateTime(strDate);
strDate
= dtDate.ToString("MM/dd/yyyy", new CultureInfo("en-US"));
Monday, 20 May 2013
RequiredFieldValidator and OnClientClick Together
function
showContent()
{
// if you need one group use
// Page_ClientValidate('VGFillHours');
if (Page_ClientValidate()) //validates all groups
{
document.getElementById("<%=ImgAjaxloaderClarification.ClientID
%>").style.display = "block";
return
true;
}
return false;
}
Wednesday, 15 May 2013
How to remove diacritics (accents) from words in SQL Server
Select 'à éêöhello!' Collate SQL_Latin1_General_CP1253_CI_AI
Create Function [String].[RemoveDiacritics] ( @p_String Varchar(Max) )
Returns Varchar(Max) As
Begin
Return @p_String Collate
SQL_Latin1_General_CP1253_CI_AI;
End
Tuesday, 14 May 2013
validation expression for gmail,yahoo
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="txtEmail"Display="Dynamic"
ErrorMessage="Invalid
Email" ValidationExpression="^([a-zA-Z0-9]+[a-zA-Z0-9._%-]*@(yahoo\.com|gmail\.com))" ValidationGroup="reg"></asp:RegularExpressionValidator>
Thursday, 18 April 2013
How can setup a friendly email name in the MailSetting section of web.config?
Well,
in code you need to put the sender's name in quotes, followed by the e-mail
address.
new
SmtpClient(...).Send("\"John Smith\" jsmith@somewhere.com",
...);
And...it
looks like you can encode it into the attribute too...
<smtp
from=""John Smith"
<jsmith@somewhere.com>">
CompareValidator for “dd/mm/yyyy” format
By default the ASP.Net CompareValidator does not work for
dd/mm/yyyy format hence we will need to change the Culture property of the page
to en-GB in the @Pagedirective of the ASP.Net Web Page as show below
<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="Request.aspx.cs"
Inherits="Request"
Culture = "en-GB"
%>
Wednesday, 17 April 2013
Standard Date Format in c#
DateTime dtStartDate, dtEndDate;
string uname = null;
string strStartDate, strEndDate;
if (txtStartDate.Text == "")
{
strStartDate = string.Format("{0:d}", Convert.ToDateTime("01-01-1900"));
}
else
{
strStartDate = string.Format("{0:d}", Convert.ToDateTime(txtStartDate.Text));
}
if (txtEndDate.Text == "")
{
strEndDate = string.Format("{0:d}", Convert.ToDateTime("01-01-2500"));
}
else
{
strEndDate = string.Format("{0:d}", Convert.ToDateTime(txtEndDate.Text));
}
dtStartDate = Convert.ToDateTime(strStartDate);
dtEndDate = Convert.ToDateTime(strEndDate);
strStartDate= dtStartDate.ToString("dd/MM/yyyy", new CultureInfo("en-US"))
strEndDate= dtEndDate.ToString("dd/MM/yyyy", new CultureInfo("en-US"))
Friday, 5 April 2013
How to delete all comments from XML using SQL?
set @XMLData.modify('delete //comment()')
select @XMLData
Wednesday, 13 March 2013
Uploading file with Progress Bar
<script language="javascript" type="text/javascript">
var
size = 2;
var id
= 0;
function
ProgressBar() {
document.getElementById("divProgress").style.display = "block";
document.getElementById("divUpload").style.display = "block";
id = setInterval("progress()", 20);
return
true;
}
function
progress() {
size = size + 1;
if
(size > 299) {
clearTimeout(id);
}
document.getElementById("divProgress").style.width = size + "pt";
document.getElementById("<%=lblPercentage.ClientID
%>").firstChild.data
= parseInt(size / 3) + "%";
}
</script>
<asp:Button ID="btnAddImage" runat="server" Text="Upload File"OnClientClick="return ProgressBar()" OnClick="btnAddImage_Click" />
<div id="divUpload"
style="display: none">
<div style="width: 300pt; text-align: center;">
Uploading...</div>
<div style="width: 300pt; height: 20px; border: solid 1pt gray">
<div id="divProgress"
runat="server"
style="width: 1pt; height: 20px; background-color: Blue;
display: none">
</div>
</div>
</div>
Tuesday, 12 March 2013
Data at the root level is invalid. Line 1, position 1.
Use doc.Load(xmlPath).
LoadXML is for loading an XML string.
LoadXML is for loading an XML string.
difference between Load And Load xml
XmlDocument doc = new XmlDocument();
doc.Load("E:\\test\\test.xml" );
LoadXML is for loading an XML file.
string xml
= " <?xml version='1.0'
encoding='UTF-8'?><MimeTypes><MimeType><Extension>.3dm</Extension><Value>x-world/x-3dmf</Value></MimeType></MimeTypes>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml );
Monday, 4 March 2013
Tuesday, 26 February 2013
Login failed for user 'sa'. Reason: The account is disabled. SQL Server
As the error says
the particular login is Disabled. Thus, we need to enable the user.
Follow these steps to enable the user.
Go to start -> programs.
Open Sql server management studio
Login to the SQL server (using windows authentication).
Expand the security tab.
Expand the Login folder.
Select the user for which you got this error. In this case 'sa'.
Right click and select properties.
Enable the user.
Save settings.
Follow these steps to enable the user.
Go to start -> programs.
Open Sql server management studio
Login to the SQL server (using windows authentication).
Expand the security tab.
Expand the Login folder.
Select the user for which you got this error. In this case 'sa'.
Right click and select properties.
Enable the user.
Save settings.
Subscribe to:
Posts (Atom)