|
<log4net>
<appender name="RollingLogFileAppenderDBConn" type="log4net.Appender.RollingFileAppender">
<file value="D:\\LogsIGT11\\AppDBlog.txt"/>
<appendToFile value="true"/>
<maxSizeRollBackups value="4"/>
<maximumFileSize value="50MB"/>
<rollingStyle value="Size"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline"/>
</layout>
</appender>
<appender name="RollingLogFileAppenderLicChk" type="log4net.Appender.FileAppender">
<file value="D:\\LogsIGT11\\AppLic.txt"/>
<!--log-data\rolling-log.txt-->
<appendToFile value="true"/>
<maxSizeRollBackups value="4"/>
<maximumFileSize value="50MB"/>
<rollingStyle value="Size"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline"/>
</layout>
</appender>
<logger name="ErrorLog">
<level value="DEBUG"/>
<maximumFileSize value="50MB"/>
<param name="Threshold" value="OFF"/>
<appender-ref ref="RollingLogFileAppenderError"/>
</logger>
<logger name="LicChkLog">
<level value="INFO"/>
<maximumFileSize value="50MB"/>
<param name="Threshold" value="OFF"/>
<appender-ref ref="RollingLogFileAppenderLicChk"/>
</logger>
</log4net>
code for accessing
public void logMessage(System.Exception th)
{
log4net.ILog logger = log4net.LogManager.GetLogger("ErrorLog");
logger.Error(System.DateTime.Now.ToString("dd-MM-yyyyHH:mm:ss"));
logger.Error(th.StackTrace);
logger.Error(th.Message);
log.Error(System.DateTime.Now.ToString("ddMMyyHHmmss"));
log.Error(th.StackTrace);
log.Error(th.Message);
}
private void WriteLogInfo(string status)
{
log4net.ILog logger = log4net.LogManager.GetLogger("LicChkLog");
logger.Error("********************START****************************");
logger.Error(System.DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"));
logger.Error(status);
logger.Error("********************END******************************");
}
For more help : pranayamr.blogspot.com
|
|
|
|
|
Hi all,
How to check if an email address exists without sending an email without using a third party control.
Thanks and Regards,
sriharsha
|
|
|
|
|
You can't. Note that sending an email offers no guarantee either. I use a black hole setup on all my mail servers, and I never reject a mail. I just throw them away.
|
|
|
|
|
Not possible really, the best you can do is use regular expression to validate that the format of the address provided is valid.
|
|
|
|
|
regular expression will only validate the email address format,which we are using,
but we want to validate the email address exixtence or atleast domain existence.
i.e to chekh if the user has mentioned a valid email id or not, and then send a email based on that.
thanks and Regards,
sriharsha
|
|
|
|
|
ansriharsha wrote: regular expression will only validate the email address format,which we are using,
Right, which is what I said.
I don't think you're going to be able to do this without sending a test email int eh first place which defeats the purpose of the exercise. Your other option is to strip the domain out, do a webrequest to it on the assumption that they have a website set up on it. If so, better chance that the email address is valid, if not, it's a dud.
|
|
|
|
|
Well that lets bogus hotmail addresses though for starters. And I work at an office where we have a .co.uk email address but a .com web site (historical nightmare, don't ask).
|
|
|
|
|
Sadly so, hence the disclaimer "better chance"
|
|
|
|
|
public static bool IsEmail(string Str)<br />
{<br />
bool v = false;<br />
if (Str != null && Str.Trim() != "")<br />
{<br />
Match m = Regex.Match(Str, @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");<br />
if (m.Success)<br />
{<br />
if (Str == m.Value)<br />
{<br />
v = true;<br />
}<br />
}<br />
}<br />
return v;<br />
}
|
|
|
|
|
Hi,
Can anybody please give me links or matarial which can explain step by step how to log errors into database table with Enterprise library 4.1 Logging Application Block? Also where to find the required definitions of table "Log" and SP "WriteLog"?
Here is the scenario:
- I am creating a web application in ASP.NET MVC project with Visual Studio 2008
- I have included reference to following 2 Microsoft Enterprise Library 4.1 dlls
Microsoft.Practices.EnterpriseLibrary.Logging
Microsoft.Practices.EnterpriseLibrary.Logging.Database
Thanks in advance
|
|
|
|
|
|
Thanks for the link. It works perfect with Database Trace Listener. The data is being saved in "Log" table through "WriteLog" procedure. But if I want my onw custom data to be inserted in my custom table, then how to configure this? Say I want to log the data in my table "ErrorLog"
ErrorLog table:
-------------------
ErrorID INT
ErrorMessage VARCHAR(1500)
And my procedure may be say "pr_LogErrors" which accespts one parameter say "@ErrorMessage"?
I tried changing the proc name in listener property "writeLogStoredProcName" but this does not work and gives error like the stored proc has too many arguments.
any idea? Thanks.
|
|
|
|
|
Hello sir, I am getting error("Invalid attempt to call Read when reader is closed.") even though there should be data present. while executing the reader second time.Can u help me to resolve the problem.
MY CODE:
SqlCommand cmd6 = new SqlCommand("select productid,serialno,qnty,price,tax,total from invoicetran where qotranid='" + ddlqono.SelectedItem.Text + "' and company_id='" + company_id.Text + "' ", myconnection);
myconnection.Open();
SqlDataReader myDataReader16 = default(SqlDataReader);
myDataReader16 = cmd6.ExecuteReader(CommandBehavior.CloseConnection);
while ((myDataReader16.Read()) == true)
{
if (myDataReader16.HasRows == true)
{
invproductid.Text = myDataReader16["productid"].ToString();
invserialno.Text = myDataReader16["serialno"].ToString();
invtot1.Text = myDataReader16["total"].ToString();
qnty2.Text = myDataReader16["qnty"].ToString();
invprice.Text = myDataReader16["price"].ToString();
invtax.Text = myDataReader16["tax"].ToString();
untprice.Text = (Convert.ToDecimal(invprice.Text)).ToString();
unttax.Text = (Convert.ToDecimal(invtax.Text)).ToString();
unttot.Text = (Convert.ToDecimal(untprice.Text) + Convert.ToDecimal(unttax.Text)).ToString();
SqlCommand cmd4 = new SqlCommand("select productid,qnty from stock where productid='" + invproductid.Text + "' and status='A' and company_id='" + company_id.Text + "' ", myconnection1);
myconnection1.Open();
SqlDataReader myDataReader9 = default(SqlDataReader);
myDataReader9 = cmd4.ExecuteReader(CommandBehavior.CloseConnection);
while ((myDataReader9.Read()) == true)
{
productid11.Text = myDataReader9["productid"].ToString();
qnty1.Text = myDataReader9["qnty"].ToString();
}
myDataReader9.Close();
myconnection1.Close();
if (qnty1.Text == qnty2.Text)
{
SqlCommand cmd5 = new SqlCommand("update stock set status='NA' where productid='" + productid11.Text + "'and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
cmd5.ExecuteNonQuery();
myconnection2.Close();
string[] sernum = null;
int I = 0;
sernum = invserialno.Text.Split(',');
for (I = 0; I <= sernum.Length - 1; I++)
{
sernum1.Text = sernum[I];
SqlCommand cmd8 = new SqlCommand("update stockserialno set status='NA' where productid='" + productid11.Text + "' and Ltrim(serialno)='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection1);
myconnection1.Open();
cmd8.ExecuteNonQuery();
myconnection1.Close();
if (dept == 1)
{
SqlCommand mycmd = new SqlCommand("select typeid from product where productid='" + invproductid.Text + "' and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
SqlDataReader myDataReader4 = default(SqlDataReader);
myDataReader4 = mycmd.ExecuteReader();
while ((myDataReader4.Read()) == true)
{
typeid = Convert.ToInt16(myDataReader4["typeid"]);
}
myDataReader4.Close();
myconnection2.Close();
if (typeid != 17)
{
SqlCommand cmd9 = new SqlCommand("update temp set invid='" + lblinvoiceid.Text + "',invdate='" + lbldate.Text + "',invprice=" + untprice.Text + ",invtax=" + unttax.Text + ",invtotal=" + unttot.Text + " where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
cmd9.ExecuteNonQuery();
myconnection2.Close();
}
else
{
SqlCommand cmd9 = new SqlCommand("update temp set invid='" + lblinvoiceid.Text + "',invdate='" + lbldate.Text + "',invprice=" + invprice.Text + ",invtax=" + invtax.Text + ",invtotal=" + invtot1.Text + " where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
cmd9.ExecuteNonQuery();
myconnection2.Close();
}
SqlCommand cmd10 = new SqlCommand("select round(pototal,0)as pototal,round(invtotal,0) as invtotal from temp where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "'", myconnection2);
myconnection2.Open();
SqlDataReader myDataReader10 = default(SqlDataReader);
myDataReader10 = cmd10.ExecuteReader(CommandBehavior.CloseConnection);
while ((myDataReader10.Read()) == true)
{
potot.Text = myDataReader10["pototal"].ToString();
invtot.Text = myDataReader10["invtotal"].ToString();
margin.Text = (Convert.ToInt64(invtot.Text) - Convert.ToInt64(potot.Text)).ToString();
SqlCommand cmd11 = new SqlCommand("update temp set margin=" + margin.Text + " where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection1);
myconnection1.Open();
cmd11.ExecuteNonQuery();
myconnection1.Close();
}
myconnection2.Close();
myDataReader10.Close();
}
else
{
Autotempid();
SqlCommand cmd14 = new SqlCommand("insert into temp values('" + lbltempid.Text + "','" + dept + "','','" + lbldate.Text + "','" + lblinvoiceid.Text + "','" + lbldate.Text + "','" + invproductid.Text + "','','','' ,'','','','" + invtot1.Text + "','" + invtot1.Text + "','" + branch_id.Text + "','" + company_id.Text + "')", myconnection1);
myconnection1.Open();
cmd14.ExecuteNonQuery();
myconnection1.Close();
}
}
}
else
{
SqlCommand cmd5 = new SqlCommand("update stock set qnty=" + qnty1.Text + "-" + qnty2.Text + " where productid='" + productid11.Text + "'and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
cmd5.ExecuteNonQuery();
myconnection2.Close();
string[] sernum = null;
int I = 0;
sernum = invserialno.Text.Split(',');
for (I = 0; I <= sernum.Length - 1; I++)
{
sernum1.Text = sernum[I];
SqlCommand cmd8 = new SqlCommand("update stockserialno set status='NA' where productid='" + productid11.Text + "' and Ltrim(serialno)='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection1);
myconnection1.Open();
cmd8.ExecuteNonQuery();
myconnection1.Close();
if (dept == 1)
{
SqlCommand mycmd = new SqlCommand("select typeid from product where productid='" + invproductid.Text + "' and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
SqlDataReader myDataReader4 = default(SqlDataReader);
myDataReader4 = mycmd.ExecuteReader();
while ((myDataReader4.Read()) == true)
{
typeid = Convert.ToInt16(myDataReader4["typeid"]);
}
myDataReader4.Close();
myconnection2.Close();
if (typeid != 17)
{
SqlCommand cmd9 = new SqlCommand("update temp set invid='" + lblinvoiceid.Text + "',invdate='" + lbldate.Text + "',invprice=" + untprice.Text + ",invtax=" + unttax.Text + ",invtotal=" + unttot.Text + " where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
cmd9.ExecuteNonQuery();
myconnection2.Close();
}
else
{
SqlCommand cmd9 = new SqlCommand("update temp set invid='" + lblinvoiceid.Text + "',invdate='" + lbldate.Text + "',invprice=" + invprice.Text + ",invtax=" + invtax.Text + ",invtotal=" + invtot1.Text + " where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection2);
myconnection2.Open();
cmd9.ExecuteNonQuery();
myconnection2.Close();
}
SqlCommand cmd10 = new SqlCommand("select round(pototal,0)as pototal,round(invtotal,0) as invtotal from temp where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "'", myconnection2);
myconnection2.Open();
SqlDataReader myDataReader10 = default(SqlDataReader);
myDataReader10 = cmd10.ExecuteReader(CommandBehavior.CloseConnection);
while ((myDataReader10.Read()) == true)
{
potot.Text = myDataReader10["pototal"].ToString();
invtot.Text = myDataReader10["invtotal"].ToString();
margin.Text = (Convert.ToInt64(invtot.Text) - Convert.ToInt64(potot.Text)).ToString();
SqlCommand cmd11 = new SqlCommand("update temp set margin=" + margin.Text + " where productid='" + invproductid.Text + "' and serialno='" + sernum1.Text + "' and company_id='" + company_id.Text + "' ", myconnection1);
myconnection1.Open();
cmd11.ExecuteNonQuery();
myconnection1.Close();
}
myconnection2.Close();
myDataReader10.Close();
}
else
{
Autotempid();
SqlCommand cmd14 = new SqlCommand("insert into temp values('" + lbltempid.Text + "','" + dept + "','','" + lbldate.Text + "','" + lblinvoiceid.Text + "','" + lbldate.Text + "','" + invproductid.Text + "','','','' ,'','','','" + invtot1.Text + "','" + invtot1.Text + "','" + branch_id.Text + "','" + company_id.Text + "')", myconnection1);
myconnection1.Open();
cmd14.ExecuteNonQuery();
myconnection1.Close();
}
}
}
}
}
myDataReader16.Close();
myconnection.Close();
|
|
|
|
|
Error itself is self explanatory.You are closing the reader before the execution is completed.
|
|
|
|
|
hi , iam using asp.net with c#
i want to store image in database , i have set the image to image control, iam not using file upload control ,how to give the image path can you correct my code
FileInfo left1infoold = new FileInfo(Server.MapPath(Image1.ImageUrl.Trim()));
byte[]left1content1=new byte[left1infoold.Length];
FileStream left1stream1 = left1infoold.OpenRead();
left1stream1.Read(left1content1,0,left1content1.Length);
left1stream1.Close();
cmdupdate.Parameters.AddWithValue("@imgleft1old",left1content1);
|
|
|
|
|
|
iam not using file upload control
just i have set the image url to image control
then how to store in data base
can you give me example which helps me
|
|
|
|
|
developerit wrote: just i have set the image url to image control
Can you post the URL of an image which you have set to image control? I just want to see where does the image actually exists.
This will help to better understand the problem.
|
|
|
|
|
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Safa"].ConnectionString);
string branchid = "";
protected void Page_Load(object sender, EventArgs e)
{
branchid= Session["branchid"].ToString();
if (IsPostBack == false)
{
Image1.ImageUrl = "left1.ashx?BranchId=" + branchid;
Image2.ImageUrl = "left1old.ashx?BranchId=" + branchid;
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmdupdate = new SqlCommand("left1update", con);
cmdupdate.CommandType = CommandType.StoredProcedure;
con.Open();
cmdupdate.Parameters.AddWithValue("@BranchId", branchid);
if ( FileUpload1.HasFile)
{
FileInfo left1info = new FileInfo( FileUpload1.PostedFile.FileName.Trim());
byte[] left1content = new byte[left1info.Length];
FileStream left1stream = left1info.OpenRead();
left1stream.Read(left1content, 0, left1content.Length);
left1stream.Close();
cmdupdate.Parameters.AddWithValue("@imgleft1",left1content);
}
cmdupdate.Parameters.AddWithValue("@notel1",txtnotes.Text);
if(cmdupdate.ExecuteNonQuery()!=0)
{
Functions.ShowAlertMessage("Updated.....");
txtnotes.Text = "";
System.Threading.Thread.Sleep(2000);
Image1.ImageUrl = "left1.ashx?BranchId=" + Session["branchid"].ToString();
Image2.ImageUrl = "left1old.ashx?BranchId=" + Session["branchid"].ToString();
}
procedure iam using
create procedure left1update(@BranchId nvarchar(50),@imgleft1 image, @notel1 nvarchar(200))
as
update tblImages set imgleft1old= CONVERT( image,imgleft1)
,imgleft1=@imgleft1 ,notel1=@notel1 where (BranchId=@BranchId)
GO
when iam clicking the button my current image should store in imgleft1old field and the newly browse one should store in imgleft1 field
but it giving error
System.Data.SqlClient.SqlException: SQL Server Internal Error. Text manager cannot continue with current statement.
can you correct my code which helps me
|
|
|
|
|
I need to cache the results when this web method is called. It is a web service.
here is the code
WebMethod _
Public Function something() As String()
Return _some.GetTesttFieldValues(_Groups.GetTestName("Something").Id, "Field3")
End Function
GetTesttFieldValues is a function.
Public Function GetTesttFieldValues(ByVal SomeId As Integer, ByVal SomeName As String) As IEnumerable(Of String) Implements ISome.GetTesttFieldValues
Dim query As New Query()
query.SomeId = SomeId
Dim documents As DocumentCollection = GetDocuments(query)
Return (From d As Document In documents Select CType(GetType(Document).GetProperty(fieldName).GetValue(d, Nothing), String)).Distinct().ToArray()
end function
|
|
|
|
|
Hey
I have a problem regarding showing my webpage in firefox. As far as Internet Explorer is concerned, the calender in javascript is working fine but the same program when i run in firefox, the calender is not popping out. Why is that and how to solve it ?
Thanks
Suchita
suchita
|
|
|
|
|
What calendar are you using? What button? Without some context how do you expect anyone to answer you?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Ok. Here is the javascript code:
function positionInfo(object) {
var p_elm = object;
this.getElementLeft = getElementLeft;
function getElementLeft() {
var x = 0;
var elm;
if(typeof(p_elm) == "object"){
elm = p_elm;
} else {
elm = document.getElementById(p_elm);
}
while (elm != null) {
x+= elm.offsetLeft;
elm = elm.offsetParent;
}
return parseInt(x);
}
this.getElementWidth = getElementWidth;
function getElementWidth(){
var elm;
if(typeof(p_elm) == "object"){
elm = p_elm;
} else {
elm = document.getElementById(p_elm);
}
return parseInt(elm.offsetWidth);
}
this.getElementRight = getElementRight;
function getElementRight(){
return getElementLeft(p_elm) + getElementWidth(p_elm);
}
this.getElementTop = getElementTop;
function getElementTop() {
var y = 0;
var elm;
if(typeof(p_elm) == "object"){
elm = p_elm;
} else {
elm = document.getElementById(p_elm);
}
while (elm != null) {
y+= elm.offsetTop;
elm = elm.offsetParent;
}
return parseInt(y);
}
this.getElementHeight = getElementHeight;
function getElementHeight(){
var elm;
if(typeof(p_elm) == "object"){
elm = p_elm;
} else {
elm = document.getElementById(p_elm);
}
return parseInt(elm.offsetHeight);
}
this.getElementBottom = getElementBottom;
function getElementBottom(){
return getElementTop(p_elm) + getElementHeight(p_elm);
}
}
function CalendarControl() {
var calendarId = 'CalendarControl';
var currentYear = 0;
var currentMonth = 0;
var currentDay = 0;
var selectedYear = 0;
var selectedMonth = 0;
var selectedDay = 0;
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var dateField = null;
function getProperty(p_property){
var p_elm = calendarId;
var elm = null;
if(typeof(p_elm) == "object"){
elm = p_elm;
} else {
elm = document.getElementById(p_elm);
}
if (elm != null){
if(elm.style){
elm = elm.style;
if(elm[p_property]){
return elm[p_property];
} else {
return null;
}
} else {
return null;
}
}
}
function setElementProperty(p_property, p_value, p_elmId){
var p_elm = p_elmId;
var elm = null;
if(typeof(p_elm) == "object"){
elm = p_elm;
} else {
elm = document.getElementById(p_elm);
}
if((elm != null) && (elm.style != null)){
elm = elm.style;
elm[ p_property ] = p_value;
}
}
function setProperty(p_property, p_value) {
setElementProperty(p_property, p_value, calendarId);
}
function getDaysInMonth(year, month) {
return [31,((!(year % 4 ) && ( (year % 100 ) || !( year % 400 ) ))?29:28),31,30,31,30,31,31,30,31,30,31][month-1];
}
function getDayOfWeek(year, month, day) {
var date = new Date(year,month-1,day)
return date.getDay();
}
this.setDate = setDate;
function setDate(year, month, day) {
if (dateField) {
if (month < 10) {month = "0" + month;}
if (day < 10) {day = "0" + day;}
var dateString = month+"-"+day+"-"+year;
dateField.value = dateString;
hide();
}
return;
}
this.changeMonth = changeMonth;
function changeMonth(change) {
currentMonth += change;
currentDay = 0;
if(currentMonth > 12) {
currentMonth = 1;
currentYear++;
} else if(currentMonth < 1) {
currentMonth = 12;
currentYear--;
}
calendar = document.getElementById(calendarId);
calendar.innerHTML = calendarDrawTable();
}
this.changeYear = changeYear;
function changeYear(change) {
currentYear += change;
currentDay = 0;
calendar = document.getElementById(calendarId);
calendar.innerHTML = calendarDrawTable();
}
function getCurrentYear() {
var year = new Date().getYear();
if(year < 1900) year += 1900;
return year;
}
function getCurrentMonth() {
return new Date().getMonth() + 1;
}
function getCurrentDay() {
return new Date().getDate();
}
function calendarDrawTable() {
var dayOfMonth = 1;
var validDay = 0;
var startDayOfWeek = getDayOfWeek(currentYear, currentMonth, dayOfMonth);
var daysInMonth = getDaysInMonth(currentYear, currentMonth);
var css_class = null; //CSS class for each day
var table = "<table cellspacing='0' cellpadding='0' border='0'>";
table = table + "<tr class='header'>";
table = table + " <td colspan='2' class='previous'><a href='javascript:changeCalendarControlMonth(-1);'><</a> <a href='javascript:changeCalendarControlYear(-1);'>«</a></td>";
table = table + " <td colspan='3' class='title'>" + months[currentMonth-1] + "<br>" + currentYear + "</td>";
table = table + " <td colspan='2' class='next'><a href='javascript:changeCalendarControlYear(1);'>»</a> <a href='javascript:changeCalendarControlMonth(1);'>></a></td>";
table = table + "</tr>";
table = table + "<tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr>";
for(var week=0; week < 6; week++) {
table = table + "<tr>";
for(var dayOfWeek=0; dayOfWeek < 7; dayOfWeek++) {
if(week == 0 && startDayOfWeek == dayOfWeek) {
validDay = 1;
} else if (validDay == 1 && dayOfMonth > daysInMonth) {
validDay = 0;
}
if(validDay) {
if (dayOfMonth == selectedDay && currentYear == selectedYear && currentMonth == selectedMonth) {
css_class = 'current';
} else if (dayOfWeek == 0 || dayOfWeek == 6) {
css_class = 'weekend';
} else {
css_class = 'weekday';
}
table = table + "<td><a class='"+css_class+"' href=\"javascript:setCalendarControlDate("+currentYear+","+currentMonth+","+dayOfMonth+")\">"+dayOfMonth+"</a></td>";
dayOfMonth++;
} else {
table = table + "<td class='empty'> </td>";
}
}
table = table + "</tr>";
}
table = table + "<tr class='header'><th colspan='7' style='padding: 3px;'><a href='javascript:hideCalendarControl();'>Close</a></td></tr>";
table = table + "</table>";
return table;
}
this.show = show;
function show(field) {
// If the calendar is visible and associated with
// this field do not do anything.
if (dateField == field) {
return;
} else {
dateField = field;
}
if(dateField) {
try {
var dateString = new String(dateField.value);
var dateParts = dateString.split("-");
selectedMonth = parseInt(dateParts[0],10);
selectedDay = parseInt(dateParts[1],10);
selectedYear = parseInt(dateParts[2],10);
} catch(e) {}
}
if (!(selectedYear && selectedMonth && selectedDay)) {
selectedMonth = getCurrentMonth();
selectedDay = getCurrentDay();
selectedYear = getCurrentYear();
}
currentMonth = selectedMonth;
currentDay = selectedDay;
currentYear = selectedYear;
if(document.getElementById){
calendar = document.getElementById(calendarId);
calendar.innerHTML = calendarDrawTable(currentYear, currentMonth);
setElementProperty('display', 'block', 'CalendarControlIFrame');
setProperty('display', 'block');
var fieldPos = new positionInfo(dateField);
var calendarPos = new positionInfo(calendarId);
var x = fieldPos.getElementLeft();
var y = fieldPos.getElementBottom();
x=x+155;
y=y-22;
setProperty('left', x + "px");
setProperty('top', y + "px");
setElementProperty('left', x + "px", 'CalendarControlIFrame');
setElementProperty('top', y + "px", 'CalendarControlIFrame');
setElementProperty('width', calendarPos.getElementWidth() + "px", 'CalendarControlIFrame');
setElementProperty('height', calendarPos.getElementHeight() + "px", 'CalendarControlIFrame');
}
}
this.hide = hide;
function hide() {
if(dateField) {
setProperty('display', 'none');
setElementProperty('display', 'none', 'CalendarControlIFrame');
dateField = null;
}
}
}
var calendarControl = new CalendarControl();
function showCalendarControl(textField) {
calendarControl.show(textField);
}
function hideCalendarControl() {
calendarControl.hide();
}
function setCalendarControlDate(year, month, day) {
calendarControl.setDate(year, month, day);
}
function changeCalendarControlYear(change) {
calendarControl.changeYear(change);
}
function changeCalendarControlMonth(change) {
calendarControl.changeMonth(change);
}
document.write("<iframe id='CalendarControlIFrame' src='javascript:false;' frameBorder='0' scrolling='no'></iframe>");
document.write("<div id='CalendarControl'></div>");
suchita
|
|
|
|
|
One, format your code properly using the pre tags. See the words code block above the textarea you used to add this mess?
Two, I didn't say, "dump everything you are using here"
Three, why reinvent to wheel. http://jqueryui.com/demos/datepicker/[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
even this third one, I couldn't use in .net..
suchita
|
|
|
|
|