|
No one has any other ideas?
|
|
|
|
|
Hi,
Insted of allowing user to download live database you can provide facility to dowonload backup.
You can write code to take backup at every some period of time and store that to some place on the server and provide the user with link to that location to download the database.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Guys,
I am using Drag and Drop Login control and
Sql Server Database (as deafult) for storing all the info..
is it possible that i could put the username logged into session as, i want to control the webpage control by username...
for example :
USER 1 can see BUTTON 1
by chking Sesssion["xyz"] == "USER1"
button.visible = false;
Hope i will get sol..
thanks and regards
govind
|
|
|
|
|
Absolutely, but I'd suggest setting up a class, on all the websites I design for work, I do the same. But for ease of use, rather than having it check a table every time for if a user has permission.
Here is my login page code behind, (all done in C#)
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Web;<br />
using System.Web.SessionState;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.HtmlControls;<br />
using System.Configuration;<br />
using MYPROJECTNAME.Components;<br />
using System.Data.OleDb;<br />
using System.Web.Security;<br />
using System.Web.Mail;<br />
<br />
namespace MYPROJECTNAME.Common<br />
{<br />
public class Login : System.Web.UI.Page<br />
{<br />
protected System.Web.UI.WebControls.Panel Panel2;<br />
protected System.Web.UI.WebControls.Panel Panel3;<br />
protected System.Web.UI.WebControls.Panel Panel4;<br />
protected System.Web.UI.WebControls.Button btnSubmit;<br />
protected System.Web.UI.WebControls.Button btnforgot;<br />
protected System.Web.UI.WebControls.TextBox UserID;<br />
protected System.Web.UI.WebControls.TextBox Password;<br />
protected System.Web.UI.WebControls.Panel Panel1;<br />
private string strConnection =ConfigurationSettings.AppSettings["MYPROJECTNAMEDataCon"];<br />
protected Commands DLCommands = new Commands();<br />
protected ConfigSettings DLConfig;<br />
protected System.Web.UI.WebControls.Label lblPassword;<br />
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;<br />
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;<br />
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;<br />
protected System.Web.UI.WebControls.Label lblMessage;<br />
string strPassword="";<br />
<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
}<br />
<br />
#region Web Form Designer generated code<br />
override protected void OnInit(EventArgs e)<br />
{<br />
InitializeComponent();<br />
base.OnInit(e);<br />
}<br />
<br />
private void InitializeComponent()<br />
{ <br />
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);<br />
this.btnforgot.Click += new System.EventHandler(this.btnforgot_Click);<br />
this.Load += new System.EventHandler(this.Page_Load);<br />
<br />
}<br />
#endregion<br />
<br />
private void btnforgot_Click(object sender, System.EventArgs e)<br />
{<br />
btnforgot.Visible=false;<br />
btnSubmit.Text="Submit";<br />
UserID.Text="";<br />
Password.Text="";<br />
lblPassword.Text="Email Address:";<br />
Password.TextMode= TextBoxMode.SingleLine;<br />
RequiredFieldValidator2.ErrorMessage="Enter your e-mail address";<br />
}<br />
<br />
private void btnSubmit_Click(object sender, System.EventArgs e)<br />
{<br />
if(btnSubmit.Text=="Login")<br />
{<br />
DoLogin();<br />
}<br />
else<br />
{<br />
DoPassword();<br />
}<br />
}<br />
private void DoLogin()<br />
{<br />
string PWD =Password.Text;<br />
string UID = UserID.Text;<br />
bool blnIsAuthenticated=false;<br />
bool boolResult =false;<br />
bool boolResult1 =false;<br />
<br />
string strSQL;<br />
strSQL="SELECT UserID,UserPWD,UserNumber,UserAdmin,Role,Reports,UserDesc,SiteAdmin,CalendarAdmin,"+<br />
" PWDAdmin, QCAccess, PlayerUnit,"+<br />
" DAG,DAG_Group,Vote,RFI,DAG_Cmt from Usertable where UserID='";<br />
strSQL+= UID +"' AND UserPWD='" + PWD +"'";<br />
try<br />
{<br />
DLConfig = new ConfigSettings(strConnection, strSQL,DataProviderType.OleDb);<br />
IDataReader dr = (IDataReader) DLCommands.ExecuteQuery(DLConfig,ReturnType.DataReaderType);<br />
while(dr.Read())<br />
{<br />
if (dr["UserPWD"].ToString().Trim()==PWD)<br />
{<br />
DateTime E2EStart = new DateTime(2006,03,20);<br />
DateTime E2EEnd = new DateTime(2007,05,04);<br />
DateTime PilotStart = new DateTime(2007,05,05);<br />
DateTime PilotEnd = new DateTime(2007,05,06);<br />
DateTime RecordStart = new DateTime(2007,05,11);<br />
DateTime RecordEnd = new DateTime(2007,05,22);<br />
DateTime CurrentDate = DateTime.Now.Date; <br />
<br />
blnIsAuthenticated=true;<br />
CUsers user = new CUsers();<br />
<br />
user.UserID=dr["UserID"].ToString();<br />
user.UserNumber=Convert.ToInt16(dr["UserNumber"]);<br />
user.SiteAdmin=Convert.ToBoolean(dr["SiteAdmin"]);<br />
user.UserAdmin=Convert.ToBoolean(dr["UserAdmin"]);<br />
user.CalendarAdmin=Convert.ToBoolean(dr["CalendarAdmin"]);<br />
user.PWDAdmin=Convert.ToBoolean(dr["PWDAdmin"]);<br />
user.QCAccess=Convert.ToBoolean(dr["QCAccess"]);<br />
user.Reports=Convert.ToBoolean(dr["Reports"]);<br />
user.Role=dr["Role"].ToString();<br />
user.Desc=dr["UserDesc"].ToString();<br />
user.PlayerUnit=dr["PlayerUnit"].ToString();<br />
user.Desc=dr["UserDesc"].ToString();<br />
user.DAGGroup=dr["DAG_Group"].ToString();<br />
user.DAG=dr["DAG"].ToString();<br />
user.RFI=dr["RFI"].ToString();<br />
user.Vote=dr["Vote"].ToString();<br />
user.DAGCmt=dr["DAG_Cmt"].ToString();<br />
<br />
<br />
<br />
<br />
<br />
<br />
if ((boolResult = CurrentDate <= E2EEnd) == true)<br />
user.TestPhase = "End-to-End";<br />
else if ((boolResult = CurrentDate >= PilotStart) == true && (boolResult1 = CurrentDate <= PilotEnd)== true)<br />
user.TestPhase="Pilot";<br />
else if ((boolResult = CurrentDate >= RecordStart) == true && (boolResult1 = CurrentDate <= RecordEnd)== true)<br />
user.TestPhase="Record";<br />
else <br />
user.TestPhase="Record";<br />
<br />
Session["SessionUser"]=user;<br />
<br />
}<br />
}<br />
dr.Close();<br />
if (blnIsAuthenticated)<br />
{ <br />
FormsAuthentication.RedirectFromLoginPage(UserID.Text,false);<br />
}<br />
else<br />
{<br />
HandleErrors("Invalid credentials please re-enter.");<br />
<br />
}<br />
}<br />
catch(Exception e)<br />
{ <br />
HandleErrors(e.Message.ToString());<br />
}<br />
}<br />
private void DoPassword()<br />
{<br />
if(Page.IsValid)<br />
{<br />
string strLastName =UserID.Text;<br />
string strEmail = Password.Text;<br />
string strSQL;<br />
strSQL="SELECT UserPWD FROM UserTable WHERE UserID='";<br />
strSQL+= UserID.Text +"' AND Email='" + Password.Text +"'";<br />
<br />
<br />
try<br />
{<br />
DLConfig = new ConfigSettings(strConnection, strSQL,DataProviderType.OleDb);<br />
OleDbDataReader dr = (OleDbDataReader) DLCommands.ExecuteQuery(DLConfig,ReturnType.DataReaderType);<br />
while(dr.Read())<br />
{<br />
strPassword = dr["UserPWD"].ToString().Trim();<br />
}<br />
dr.Close();<br />
}<br />
catch (Exception err)<br />
{<br />
HandleErrors("Error accessing database.<br />"); <br />
}<br />
<br />
<br />
if (strPassword!="")<br />
{<br />
CreateMailMessage();<br />
<br />
}<br />
else<br />
{ <br />
HandleErrors ("Invalid credentials please re-enter.");<br />
}<br />
}<br />
else<br />
HandleErrors("Fill in your email address!");<br />
}<br />
private void HandleErrors(string ErrorMessage)<br />
{<br />
lblMessage.Text=ErrorMessage;<br />
}<br />
private void CreateMailMessage()<br />
{<br />
try<br />
{<br />
MailMessage newMail = new MailMessage();<br />
newMail.From="E_MAIL ADDRESS REMOVED FOR POSTING ON CODE PROJ";<br />
newMail.To=Password.Text;<br />
newMail.Subject="Your MYPROJECTNAME Password";<br />
newMail.Body="Your password is "+strPassword+".";<br />
SmtpMail.SmtpServer="147.241.230.101";<br />
SmtpMail.Send(newMail);<br />
HandleErrors("Your Password will be emailed!");<br />
lblPassword.Text="Password:";<br />
btnSubmit.Text="Login";<br />
Password.TextMode= TextBoxMode.Password;<br />
Password.Text="";<br />
<br />
lblMessage.Text="An email has been sent to you that contains your password.";<br />
}<br />
catch(Exception err)<br />
{<br />
string s = err.Message;<br />
HandleErrors(s);<br />
}<br />
<br />
}<br />
<br />
private void GetSiteData()<br />
{<br />
bool bIsError=false;<br />
string myLoc = ""; <br />
CUsers user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
OleDbConnection con = new OleDbConnection(strConnection);<br />
<br />
try<br />
{<br />
OleDbCommand cmdLoc = con.CreateCommand();<br />
cmdLoc.CommandText="SELECT LoginID, MYPROJECTNAMESite FROM Demographics Where LoginID ='" + user.UserID +"'";<br />
con.Open();<br />
OleDbDataReader drLoc= cmdLoc.ExecuteReader();<br />
while (drLoc.Read())<br />
{<br />
myLoc=(drLoc["MYPROJECTNAMESite"].ToString().Trim());<br />
}<br />
<br />
user.TestSite = myLoc;<br />
<br />
con.Close();<br />
<br />
}<br />
catch (Exception err)<br />
{<br />
string str=err.Message;<br />
lblMessage.Visible=true;<br />
lblMessage.Text=str.ToString();<br />
bIsError=true;<br />
}<br />
finally<br />
{<br />
if(con.State.ToString() == "Open")<br />
con.Close();<br />
}<br />
<br />
}<br />
<br />
}<br />
}<br />
Here is the mainpage were, users get directed were they need to go
using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Web;<br />
using System.Web.SessionState;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.HtmlControls;<br />
using MYPROJECTNAME.Components;<br />
<br />
namespace MYPROJECTNAME.Common<br />
{<br />
public class Main : System.Web.UI.Page<br />
{<br />
protected System.Web.UI.WebControls.LinkButton btnChangePassword;<br />
protected MYPROJECTNAME.Server.Navigator MenuNav;<br />
protected System.Web.UI.WebControls.Button Button1;<br />
protected System.Web.UI.WebControls.Panel Panel1;<br />
protected System.Web.UI.WebControls.Button btnSME;<br />
protected System.Web.UI.WebControls.Button btnDCForm;<br />
protected System.Web.UI.WebControls.Button btnFunctionalUser;<br />
protected System.Web.UI.WebControls.Button btnSAForm;<br />
protected System.Web.UI.WebControls.Button btnHelpDesk;<br />
protected System.Web.UI.WebControls.Button btnEditOperTIR;<br />
CUsers user;<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
if(!IsPostBack)<br />
{<br />
user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
if(user.PlayerUnit != "N/A")<br />
{<br />
Response.Redirect("../Common/UserFormControl.aspx");<br />
}<br />
else<br />
{<br />
SetVisibility();<br />
}<br />
}<br />
<br />
}<br />
private void SetVisibility()<br />
{<br />
switch(user.Desc)<br />
{<br />
case "User":<br />
btnHelpDesk.Enabled=false;<br />
btnSME.Enabled=false;<br />
btnSAForm.Enabled=false;<br />
btnDCForm.Enabled=false;<br />
btnFunctionalUser.Enabled=true;<br />
break;<br />
case "DC":<br />
btnHelpDesk.Enabled=false;<br />
btnSME.Enabled=false;<br />
btnSAForm.Enabled=false;<br />
btnDCForm.Enabled=true;<br />
btnFunctionalUser.Enabled=false;<br />
break;<br />
case "SME":<br />
btnHelpDesk.Enabled=false;<br />
btnSME.Enabled=true;<br />
btnSAForm.Enabled=false;<br />
btnDCForm.Enabled=false;<br />
btnFunctionalUser.Enabled=false;<br />
break;<br />
case "SA":<br />
btnHelpDesk.Enabled=false;<br />
btnSME.Enabled=false;<br />
btnSAForm.Enabled=true;<br />
btnDCForm.Enabled=false;<br />
btnFunctionalUser.Enabled=false;<br />
break;<br />
case "TL":<br />
btnHelpDesk.Enabled=true;<br />
btnSME.Enabled=true;<br />
btnSAForm.Enabled=true;<br />
btnDCForm.Enabled=true;<br />
btnFunctionalUser.Enabled=true;<br />
break;<br />
case "HD":<br />
btnHelpDesk.Enabled=true;<br />
btnSME.Enabled=false;<br />
btnSAForm.Enabled=false;<br />
btnDCForm.Enabled=false;<br />
btnFunctionalUser.Enabled=false;<br />
break;<br />
case "ORA":<br />
btnHelpDesk.Enabled=true;<br />
btnSME.Enabled=true;<br />
btnSAForm.Enabled=true;<br />
btnDCForm.Enabled=true;<br />
btnFunctionalUser.Enabled=true;<br />
break;<br />
}<br />
}<br />
#region Web Form Designer generated code<br />
override protected void OnInit(EventArgs e)<br />
{<br />
InitializeComponent();<br />
base.OnInit(e);<br />
}<br />
<br />
private void InitializeComponent()<br />
{ <br />
this.btnSME.Click += new System.EventHandler(this.btnSME_Click);<br />
this.btnDCForm.Click += new System.EventHandler(this.btnDCForm_Click);<br />
this.btnFunctionalUser.Click += new System.EventHandler(this.btnFunctionalUser_Click);<br />
this.btnSAForm.Click += new System.EventHandler(this.btnSAForm_Click);<br />
this.btnHelpDesk.Click += new System.EventHandler(this.btnHelpDesk_Click);<br />
this.btnEditOperTIR.Click += new System.EventHandler(this.btnEditOperTIR_Click);<br />
this.btnChangePassword.Click += new System.EventHandler(this.btnChangePassword_Click);<br />
this.Load += new System.EventHandler(this.Page_Load);<br />
<br />
}<br />
#endregion<br />
<br />
<br />
<br />
private void LinkButton1_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("../Common/ChangeUserID.aspx?Change=1");<br />
}<br />
<br />
private void btnChangePassword_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("../Common/ChangeUserID.aspx?Change=2");<br />
}<br />
<br />
private void btnSME_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("./SMEFormControl.aspx");<br />
}<br />
<br />
<br />
<br />
private void btnFunctionalUser_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("./UserFormControl.aspx");<br />
}<br />
<br />
private void btnSAForm_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("./SAFormControl.aspx");<br />
}<br />
<br />
private void btnHelpDesk_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("../Forms/HelpDesk.aspx");<br />
}<br />
<br />
private void btnDCForm_Click(object sender, System.EventArgs e)<br />
{<br />
Response.Redirect("./DCFormControl.aspx");<br />
}<br />
<br />
private void btnEditOperTIR_Click(object sender, System.EventArgs e)<br />
{<br />
user =new CUsers();<br />
user=(CUsers)Session["SessionUser"];<br />
if(user.Desc == "DC")<br />
Response.Redirect("../Forms/EditTIR.aspx?From=DC");<br />
else<br />
Response.Redirect("../Forms/EditTIR.aspx?From=Main");<br />
}<br />
}<br />
}<br />
And finaly you will see that I call a class, called Cuser
using System;<br />
<br />
namespace MYPROJECTNAME.Components<br />
{<br />
public class CUsers<br />
{<br />
private string _UserID;<br />
private string _Role;<br />
private string _Desc;<br />
private int _UserNumber;<br />
private bool _UserAdmin;<br />
private bool _CalendarAdmin;<br />
private string _PlayerUnit;<br />
private bool _PWDAdmin;<br />
private bool _QCAccess;<br />
private bool _SiteAdmin;<br />
private bool _Enabled;<br />
private bool _Reports;<br />
private string _TestSite;<br />
private string _TestPhase;<br />
private string _DAGGroup;<br />
private string _DAG;<br />
private string _RFI;<br />
private string _DAGCmt;<br />
private string _Vote;<br />
private string _AddMsg;<br />
private bool _DataDnload;<br />
<br />
<br />
<br />
#region Public properties for the class<br />
<br />
public string UserID<br />
{<br />
get<br />
{<br />
return _UserID;<br />
}<br />
set<br />
{<br />
_UserID=value;<br />
}<br />
}<br />
public string PlayerUnit<br />
{<br />
get<br />
{<br />
return _PlayerUnit;<br />
}<br />
set<br />
{<br />
_PlayerUnit=value;<br />
}<br />
}<br />
public string Role<br />
{<br />
get<br />
{<br />
return _Role;<br />
}<br />
set<br />
{<br />
_Role=value;<br />
}<br />
}<br />
public string Desc<br />
{<br />
get<br />
{<br />
return _Desc;<br />
}<br />
set<br />
{<br />
_Desc=value;<br />
}<br />
}<br />
public int UserNumber<br />
{<br />
get<br />
{<br />
return _UserNumber;<br />
}<br />
set<br />
{<br />
_UserNumber=value;<br />
}<br />
}<br />
<br />
public bool UserAdmin<br />
{<br />
get<br />
{<br />
return _UserAdmin;<br />
}<br />
set<br />
{<br />
_UserAdmin=value;<br />
}<br />
}<br />
public bool CalendarAdmin<br />
{<br />
get<br />
{<br />
return _CalendarAdmin; <br />
}<br />
set<br />
{<br />
_CalendarAdmin=value;<br />
}<br />
}<br />
public bool PWDAdmin<br />
{<br />
get<br />
{<br />
return _PWDAdmin; <br />
}<br />
set<br />
{<br />
_PWDAdmin=value;<br />
}<br />
}<br />
public bool QCAccess<br />
{<br />
get<br />
{<br />
return _QCAccess; <br />
}<br />
set<br />
{<br />
_QCAccess=value;<br />
}<br />
}<br />
public bool SiteAdmin<br />
{<br />
get<br />
{<br />
return _SiteAdmin; <br />
}<br />
set<br />
{<br />
_SiteAdmin=value;<br />
}<br />
}<br />
public bool Enabled<br />
{<br />
get<br />
{<br />
return _Enabled; <br />
}<br />
set<br />
{<br />
_Enabled=value;<br />
}<br />
}<br />
public bool Reports<br />
{<br />
get<br />
{<br />
return _Reports; <br />
}<br />
set<br />
{<br />
_Reports=value;<br />
}<br />
}<br />
public bool DataDnload<br />
{<br />
get<br />
{<br />
return _DataDnload; <br />
}<br />
set<br />
{<br />
_DataDnload=value;<br />
}<br />
}<br />
public string TestPhase<br />
{<br />
get<br />
{<br />
return _TestPhase; <br />
}<br />
set<br />
{<br />
_TestPhase=value;<br />
}<br />
}<br />
public string TestSite<br />
{<br />
get<br />
{<br />
return _TestSite; <br />
}<br />
set<br />
{<br />
_TestSite=value;<br />
}<br />
}<br />
public string DAG<br />
{<br />
get<br />
{<br />
return _DAG; <br />
}<br />
set<br />
{<br />
_DAG=value;<br />
}<br />
}<br />
public string Vote<br />
{<br />
get<br />
{<br />
return _Vote; <br />
}<br />
set<br />
{<br />
_Vote=value;<br />
}<br />
}<br />
public string DAGGroup<br />
{<br />
get<br />
{<br />
return _DAGGroup; <br />
}<br />
set<br />
{<br />
_DAGGroup=value;<br />
}<br />
}<br />
public string RFI<br />
{<br />
get<br />
{<br />
return _RFI; <br />
}<br />
set<br />
{<br />
_RFI=value;<br />
}<br />
}<br />
public string DAGCmt<br />
{<br />
get<br />
{<br />
return _DAGCmt; <br />
}<br />
set<br />
{<br />
_DAGCmt=value;<br />
}<br />
}<br />
public string AddMsg<br />
{<br />
get<br />
{<br />
return _AddMsg; <br />
}<br />
set<br />
{<br />
_AddMsg=value;<br />
}<br />
}<br />
#endregion<br />
<br />
<br />
public CUsers()<br />
{<br />
}<br />
}<br />
}<br />
|
|
|
|
|
i'm using visula studio 2005, web application
i'm retriving a data from the database and viewing it in textboxes.
i had one password field, and when i set the textmode property of the textbox to password mode no data displayed. i checked that the field has data and when i set the textmode property of the textbox to singleline it appears.
|
|
|
|
|
|
Hi guys
Hope someone will be able to help. I am using C# in Visual Studio 2005. Our client wants to add a Gridview to an ASP.NET application, but the tricky part that I cant figure out is: He wants the header row to stay static when the user scroll down the page. The GridView control for windows allows you to freeze the header row, but not the ASP.NET GridView control. Pleeeeeease help!!!
|
|
|
|
|
I think it is possible with Ajax.
Did you try with Ajax.
Regards,
Satips.
|
|
|
|
|
Thanx a million for the reply. No, I haven't tried ajax yet. Not farmiliar with it, but will do some research.
Regards,
Elizma
|
|
|
|
|
hi
try this link a code project article
http://www.codeproject.com/useritems/FreezeHeader.asp
|
|
|
|
|
Thank you so much!!! It works beautifully!!!
Very Greatful Programmer,
Elizma
|
|
|
|
|
i want to generate a unique primary key, something similar to the auto increment feature, but i do not want it to be auto increment.
The reasoning for this is: this table will have rows deleted by the hundreds every day, and maybe even thousands in a few years (I hope!), All the while having more rows replace the ones that were erased. Is there a way to have mysql create a unique key that is just randomly generated?
Thanks in advance!
|
|
|
|
|
Why do you think that an auto icrementing key would be a problem?
If you create 10000 new records each day, it will take more than 500 years until it reaches it's maximum value. If that seems too little, just use a 64 bit integer as key, and you can create a billion records every day for 25 million years.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi to All,
Hoow Can I access Pay pal return values.
I did find that the PayPal Sandbox works OK to do some testing without a real account. It took a little bit to understand what all I needed to create.
I am still not sure how to get the amount parameter sent back via a querystring or if that is not possible, how to read in the POST info that should be posted.
It's very urgent
Thank you
-- modified at 7:21 Saturday 14th April, 2007
|
|
|
|
|
|
hi friends
I have need javascript to enter only numerics value in textbox on text change events not on Submit button events.
Plz give me some link
Thanks in adavance
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Server Side -
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("onkeydown", "return checkvalid()");// Call Javascrip
}
Client Side -
function checkvalid()
{
var sTxt = event.srcElement.value;
var i = event.keyCode;
//alert(i);
if((i<47 || i>58) && i!=8 && i!=16 && i!=20)
{
alert("Not allowed");
event.srcElement.value="";
return false;
}
}
But remind when you are adding attributes to this control requirefield validator will not work.
Regards,
Mayank Parmar
Senior Software Engineer
Amba Tech
Gandhinagar, India
|
|
|
|
|
You can check for event.keyCode on onKeyUp eventhandler. If it is not number, you can NULL it.
|
|
|
|
|
Hi there,
I am using .NET 2.0 with C#.
I have a website project. I also have a master page in the root directory called Website.master. In the “code behind” of this master file I have the following namespace MyNamespace.Master. When I view the object browser I don’t see this namespace there. Why is this?? Visual Studio only seems to add the namespaces that are in the Bin and App_Code folders. I don’t know if I’m not viewing it correctly, but I can not see it there.
Please can some one help me?
Regards
ma se
|
|
|
|
|
Hi everybody
The formview modechange events are not fired, when i try to change the modes to insert,edit,readonly.
Thanks in advance
|
|
|
|
|
Hi in sqlserver stored procedure i am doing some calculations...,
See the below procedure:
select a.empid,b.empName,c.Whrs,c.srg,case when srg=0 then @Outsunday else @Insunday end as days,c.Bassalary,
(Bassalary/(days*Whrs)) as onehour,
sum(AppWHours) as TWhrs,Sum(AppOtHours) as TOThrs
from tblMonthHourDetails a,tblemployeemaster b,tblsalarydetails c where
a.empid=b.empid and a.empid=c.empid and
b.projectid=@projectid and datepart(mm,[SDate])=@months and datepart(yy,[SDate])=@Years group by a.empid,b.empName,c.Whrs,c.srg,c.Bassalary
In that above procedure using case condition i am getting one column "days" like...,
That days value i want to use to calculate for onehour column,
if i give there days(highlighted in above procedure) value its telling error msg like invalid column days like...,
but i want to use that value there how to use...,
Plz any one solve my probs.....,
Magi
|
|
|
|
|
Please don't spam the site. The SQL forum is the right place for this ( although I have answered it in the C# forum )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
HI Gurus,
How can I format 50000 integer to this format 50,000?
I tried using string.format("{0:#,#}", variable) but the result always come with a decimal value 50,000.00
Thanks
dom
|
|
|
|
|
I think it's string.format("0:f2") ( for two points after the decimal )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
int i=50000;
i=i.ToString("##,###");
Please try this...
|
|
|
|
|