jquery get asp.net label text
var labelText = $('#<%= lblabc.ClientID %>').html();
Achievement provides the only real pleasure in life
var labelText = $('#<%= lblabc.ClientID %>').html();
Posted by
SF
at
4:57 pm
0
comments
if ($('#isAgeSelected').is(':checked')){
//your code here
}
Posted by
SF
at
3:31 pm
0
comments
DATEPART(portion, datetimevalue)
the options for portion are:
Ms for Milliseconds
Yy for Year
Qq for Quarter of the Year
Mm for Month
Dy for the Day of the Year
Dd for Day of the Month
Wk for Week
Dw for the Day of the Week
Hh for Hour
Mi for Minute
Ss for Second
e.g.
select startdate,DATEPART(Hh,a.startdate)
this returns the hour of startdate
Posted by
SF
at
11:11 am
0
comments
if you want something like "22/11/2012 15:00" then use
columns.Bound(o => o.MyDateTimeValue).Format("{0:dd/MM/yyyy HH:mm}").Width(120);
if you want something like "22/11/2012 3:00 PM" then use
columns.Bound(o => o.MyDateTimeValue).Format("{0:dd/MM/yyyy hh:mm tt}").Width(120);
Posted by
SF
at
1:56 pm
0
comments
i keep forgetting this simple solution:
char(13)
now I save it here so that I never forget again
Posted by
SF
at
6:00 pm
0
comments
I have a multi-line postal address (string PostalAddressString) like this:
Address1:12 Garden Street
Address2:
Suburb:Abc
PostCode:123
State:BC
Country:ABCDE
Posted by
SF
at
10:10 am
0
comments
Use this method:
OnDetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
The ParentKeyValues can be accessed this way:
e.DetailTableView.ParentItem.GetDataKeyValue("StoreId")
Posted by
SF
at
1:32 pm
0
comments
update d
set d.dname = "HR"
from Department d
inner join employee e
on e.employeeID = d.employeeID
where d.departmentID = 1
Posted by
SF
at
12:10 pm
0
comments
When I setup master detail table relationship in my report i noticed that the master records which do not have any related detail records will not be shown.
The trick is to set "Print if Detail Empty" property of the master data band to "true"
Posted by
SF
at
11:46 am
0
comments
have a reference:
using System.Web.Configuration;
WebConfigurationManager.AppSettings["propertyName"]
Posted by
SF
at
2:41 pm
0
comments
solution is to have a corresponding GridBoundColumn, and set DefaultInsertValue="false" in the column definition
Posted by
SF
at
10:13 am
0
comments
my radgrid uses Tempalte in EditFormSettings. It current contains 2 pages of data.
When I click on Add New Record the command button on top of the grid, the edit form opens correctly in insert mode. However when I look closely at the data, it actually shows the second page, and the page number on the bottom of the grid shows "2".
The solution is to set
Posted by
SF
at
10:12 am
0
comments
--rename a table:
EXEC sp_rename 'OldTableName', 'NewTableName'
--rename a column:
EXEC sp_rename
@objname = 'TableName.OldColumnName',
@newname = 'NewColumnName',
@objtype = 'COLUMN'
Posted by
SF
at
10:12 am
0
comments
Class1 obj= new Class1();
string propertyName = "name1";
string objValue = "";
Type type = obj.GetType();
PropertyInfo prop = type.GetProperty(propertyName );
prop.SetValue(obj, objValue , null);
Posted by
SF
at
2:20 pm
0
comments
string text1 = this.Server.MapPath("~/" + [FileFolder]);
if (Directory.Exists(text1))
{
string text2 = text1 + @"\[File Name with extension]";
if (System.IO.File.Exists(text2))
{
FileStream stream1 = new FileStream(text2, FileMode.Open, FileAccess.Read);
byte[] buffer1 = new byte[((int)stream1.Length) + 1];
stream1.Read(buffer1, 0, (int)stream1.Length);
stream1.Close();
//Writes the file out the Response object
Response.Clear();
Response.Buffer = true;
Response.AddHeader("Content-Disposition", "attachment;filename=\"[File Name with extension]\";");
Response.WriteFile(text2, true);
Response.ContentType = "application/x-zip-compressed";
Response.BinaryWrite(buffer1);
Response.End();
}
}
Posted by
SF
at
10:34 am
0
comments
http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx
Posted by
SF
at
10:49 am
0
comments
found this helpful
http://visualstudiohacks.com/general/confessions-of-a-keyboard-junkie/
Posted by
SF
at
11:14 am
0
comments
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + RadUpload.UploadedFiles[0].FileName+";" +
"Extended Properties=Excel 8.0;";
OleDbConnection objConn = new OleDbConnection(sConnectionString);
objConn.Open();
OleDbCommand cmdSelectAdditions = new OleDbCommand("SELECT * FROM [Sheet1$]", objConn);
OleDbDataAdapter AdapterForAdditions = new OleDbDataAdapter();
AdapterForAdditions.SelectCommand = cmdSelectAdditions;
DataSet dsAdditions = new DataSet();
AdapterForAdditions.Fill(dsAdditions);
objConn.Close();
Posted by
SF
at
4:16 pm
0
comments
this article helped me, hope it helps you too!
http://www.4guysfromrolla.com/articles/030911-1.aspx
I need to parse HTML into the pdf, the implementation is:
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Transactions.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Document document = new Document(PageSize.A1, 10f, 10f, 10f, 0f);
PdfWriter.GetInstance(document, Response.OutputStream);
// Open the Document for writing
document.Open();
string documentContent = string.Empty;
document.NewPage();
documentContent = "Confirmation" + "
" + body;
StringReader sr = new StringReader(documentContent);
foreach (object item in HTMLWorker.ParseToList(sr, null).ToList())
{
document.Add((IElement)item);
}
document.Close();
Response.Write(document);
Response.End();
Posted by
SF
at
2:18 pm
0
comments
found this article very helpful
http://support.microsoft.com/kb/306572/
I modified it a bit to work for me (I am using RadUpload to get the file):
// Create connection string variable. Modify the "Data Source"
// parameter as appropriate for your environment.
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + ruImporter.UploadedFiles[0].FileName+";" +
"Extended Properties=Excel 8.0;";
// Create connection object by using the preceding connection string.
OleDbConnection objConn = new OleDbConnection(sConnectionString);
// Open connection with the database.
objConn.Open();
// The code to follow uses a SQL SELECT command to display the data from the worksheet.
// Create new OleDbCommand to return data from worksheet.
OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [Sheet1$]", objConn);
// Create new OleDbDataAdapter that is used to build a DataSet
// based on the preceding SQL SELECT statement.
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
// Pass the Select command to the adapter.
objAdapter1.SelectCommand = objCmdSelect;
// Create new DataSet to hold information from the worksheet.
DataSet objDataset1 = new DataSet();
// Fill the DataSet with the information from the worksheet.
objAdapter1.Fill(objDataset1);
// Clean up objects.
objConn.Close();
Posted by
SF
at
10:09 am
0
comments