|
Iam using ASP.Net2.0 with VB.Net.
Iam having a code for validation to the controls which can be called on KEYpress Event i.e. checking for each keypress event related to that control where I have written this code in vbscript.How that function can be called in application or to a control
Can anybody give me the exact syntax to this or help in writing easiest way fro validation of all the controls.
Priya
|
|
|
|
|
txtName.Attribute.Add("onkeypress","yourvbscriptfunction") ?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Priya_2007 wrote: How that function can be called in application or to a control
You have to add attributes to all the controls. Assume you have a textbox with name Text1, then you could add Text1.Attributes.Add("onkeypress","function()") . You should change the event name and calling methods according to VBScript syntax.
Priya_2007 wrote: I have written this code in vbscript.
Why ? Better use javascript. VBScript is supported only in Internet Explorer.
|
|
|
|
|
In which event I have to write the text1.attributes.add("onkeypress","function()")
Parameters of the Function will be valuetype,keyascii of pressed key,text present in the control
How this can be specified
Priya
|
|
|
|
|
Priya_2007 wrote: In which event I have to write the text1.attributes.add("onkeypress","function()")
felicitous place would be Page_Load() .
Priya_2007 wrote: Parameters of the Function will be valuetype,keyascii of pressed key,text present in the control
What is valuetype ? I am not well-known in VBScript. In javascript it can be written like
Text1.Attributes.Add("OnKeyPress","Function(valuetype,event);");
event contains the keyCode which is used to find what is the key pressed.
|
|
|
|
|
Where I have to write the VBScript function either in the Source file or COde File.
Or else can u please suggest where to VBscript file outside and importing of that vbscript file into the project
Priya
|
|
|
|
|
U can use vbscript file in Source
<Script language="VB">
code here
</Script>
Best Regard
Patha
---------------------------------------------------
|
|
|
|
|
code here
THis can be written in the Source file where I have to call the Function present in the Script into code file which may not move to the function present in the Source file.
Priya
|
|
|
|
|
Priya_2007 wrote: Where I have to write the VBScript function either in the Source file or COde File.
you can use in the source file as Pathan suggested
Priya_2007 wrote: uggest where to VBscript file outside and importing of that vbscript file into the project
Sorry no idea on vbscript much
|
|
|
|
|
Hi Can any one help me how to do the paging for DataList in ASP.Net 1.1
Please do help me.
chandu
|
|
|
|
|
|
|
How can i enter a date in other format than Gregorian and upon tab for example change it to its equivillant in Gregorian.
thanks
|
|
|
|
|
u can do it like
DataTime.Now.ToString("MM/dd/yyyy");
|
|
|
|
|
i am having a problem.how to store the cells value stored in a row of a gridview on the click event of row.there is no command argument in the gridview.its just a row.am using JS on click event.please help me out
|
|
|
|
|
lcharan wrote: there is no command argument in the gridview.its just a row.am using JS on click event
Ya there is no event for this since gridview is rendered as plain HTML table. What's the problem you are facing with JS onclick ?
|
|
|
|
|
function fnMoveItems(lstbxFrom,lstbxTo)
{
var varFromBox = document.all(lstbxFrom);
var varToBox = document.all(lstbxTo);
if ((varFromBox != null) && (varToBox != null))
{
if(varFromBox.length < 1)
{
alert('There are no items in the source ListBox');
return false;
}
if(varFromBox.options.selectedIndex == -1)
{
alert('Please select an Item to move');
return false;
}
while ( varFromBox.options.selectedIndex >= 0 )
{
var newOption = new Option();
newOption.text = varFromBox.options[varFromBox.options.selectedIndex].text;
newOption.value = varFromBox.options[varFromBox.options.selectedIndex].value;
varToBox.options[varToBox.length] = newOption;
varFromBox.remove(varFromBox.options.selectedIndex);
}
}
return false;
}
The above is my javascript code to move the values from one listbox to another. Once it move the values , the selected values are deleted from the sourceListbox(ie., left side listbox).
Actually my task is , it never deletes the selected value .
pls give the alternate code for it.
|
|
|
|
|
I have modified your code, you can use it.
function fnMoveItems(lstbxFrom,lstbxTo)
{
//var varFromBox = document.all(lstbxFrom);
//var varToBox = document.all(lstbxTo);
//You can access by list box id like
//var varFromBox = document.getElementById('lstbxFromID');
//var varToBox = document.getElementById('lstbxToID');
if ((varFromBox != null) && (varToBox != null))
{
if(varFromBox.length < 1)
{
alert('There are no items in the source ListBox');
return false;
}
if(varFromBox.options.selectedIndex == -1)
{
alert('Please select an Item to move');
return false;
}
var i;
for(i=varFromBox.options.length-1;i>=0;i--)
{
if(varFromBox.options[i].selected)
{
var optn = document.createElement("OPTION");
optn.text = varFromBox.options[i].text;
optn.value = varFromBox.options[i].value;
lstbxTo.options.add(optn);
varFromBox.remove(i);
}
}
}
return false;
}
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Hello !1
actually i wanted to know that how can I display the contents of a text file in asp.net page . I am using vs.net 2003
Mrinal
|
|
|
|
|
Mri1a wrote: i wanted to know that how can I display the contents of a text file in asp.net page
1 - Map your text file using Server.MapPath()
2 - Use StreamReader class to start reading
3 - Assign value to a Label/Literal in ASPX page.
4 - Dispose StreamReader object
|
|
|
|
|
Dont repost.I did give u solution.
declare namespance "System.IO"
try this.It return content of .txt file
File.ReadAllText(Server.MapPath("content.txt"));
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
|
I'm using the in-build login feature for my web sites login with roles
Roles:Staff,Manager
I would like to know how to set the login so that when the staff logs in
he/she is directed to staff page instantly this also has to be the same for
the manager
|
|
|
|
|
duo!@# wrote: in-build login feature
Don't know what is that are you saying about built in login control ?
Any way for that if you have home page then in home page check the credetials for the logged in user according to that make server.transfer to respective page
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
What i meant by build in login control, instead of having a code based login which validates from the database. You get to pick up login controls from the toolbox and use the asp.net config to set roles and users.
To make it short an easier way of creating logins.
|
|
|
|