|
hi, how do i format in regular expression
tin no : xxx-xxx-xxx where x is 0 to 9
im new to regular expression and so far
my expression seems not to be valid
im suppose to use it in a webform with
regular expression validator
thx
|
|
|
|
|
The expression looks something like \d{3}-\d{3}-\d{3} .
You can check out the tutorial[^] to get started.
|
|
|
|
|
this is the code : the aim is almost like an auto complete
when tin no exists in db
it automatically loads the name of establishment in text box
of establishment and make it readonly else allow input.
in add mode i don't have a problem since the tin no textbox
initially has no value but when i am in
edit mode where i retrieved from the db the tin no to
tin no text box. what happens is when i type like another
existing tin no it works but when i use last tin no that was
retrieved from db that's when the error occurs
any ideas?
---------------------------------------------
<form id="form1" method="post" runat="server">
<script type="text/javascript">
var Cbo = new CallBackObject();
Cbo.OnComplete = Cbo_Complete;
Cbo.OnError = Cbo_Error;
function CheckTin(strTin)
{
//var msg = document.getElementById('lblNameOfEstablishmentValue');
//var msgText = document.getElementById('txtEstablishment').value;
if (strTin.length > 0)
{
Cbo.DoCallBack('txtTIN', '');
}
else
{
Cbo.AbortCallBack();
msg.innerHTML = '';
//msgText.value = '';
//document.getElementById('txtEstablishment').value = '';
}
}
function Cbo_Complete(responseText, responseXML)
{
//var msg = document.getElementById('lblNameOfEstablishmentValue');
//var msgText = document.getElementById('txtEstablishment').value;
if( responseText.length == 0)
{
//msg.innerHTML = '';
//msgText.value = '';
document.getElementById('txtEstablishment').value = '';
document.getElementById('txtEstablishment').readonly=true;
}
else
{
//msg.innerHTML = responseText;
//msgText.value = responseText;
document.getElementById('txtEstablishment').value = responseText;
document.getElementById('txtEstablishment').readonly=false;
}
}
function Cbo_Error(status, statusText, responseText)
{
//alert(responseText);
document.getElementById('lblError').innerHTML = responseText;
}
</script>
<table>
<tr>
<td>
Tin:<asp:textbox id="txtTIN" tabIndex="6" runat="server" MaxLength="12" onkeyup="CheckTin(this.value);" OnTextChanged="txtTIN_TextChanged"></asp:textbox>
</td>
</tr>
<tr>
<td>
Establisment:<asp:textbox id="txtEstablishment" tabIndex="8" runat="server" Width="100%" MaxLength="100"></asp:textbox>
</td>
</tr>
</table>
</form>
-------------------------------
thanks
|
|
|
|
|
This kind of error occurs when an input field has text in it that could potentially be code. A hacker could write html and javascript into a textbox and use it to compromise a web page. By default, ASP.Net will check input fields for this kind of danger and will report an error when it sees anything like this. You can turn off this check by using the validateRequest attribute on the Page directive.
Logifusion[^]
|
|
|
|
|
ic, thx
by the way, how do i turn off
i know i can put validateRequest = false
but where is Page directive?
thx again
|
|
|
|
|
finally found it
it goes to the html part, not in code behind
<%@ Page Language="VB" ValidateRequest="False"%>
thx
|
|
|
|
|
is there another way we could do without turning it off?
coz if i turn if off, then i would need to validate all textbox fields for
script tags?
i tested it with validateRequest=false
the textbox return html codes of the whole postback instead
thx
-- modified at 13:37 Tuesday 18th July, 2006
|
|
|
|
|
does this mean that it only works on label control
i tested it on label and it works fine
but in textbox control this error occurs
what others ways so i can still use the textbox?
|
|
|
|
|
You have to be more specific. What did you try on the label control and what did you try on the textbox control? Is the error still a validate request error even though you have it in the page directive?
Logifusion[^]
|
|
|
|
|
since i am using ajax
the aim is almost like an auto complete (typing)
when tin no exists in db
it automatically loads the name of establishment in text box
of establishment and make it readonly else allow input
i tested it first using label control for establishment
when i saw that it works i replaced it with textbox
tested this in add mode
in add mode it works, but in edit mode where i
populate the value of tin no textbox the error occurs
when i use the value that was populated in page load event
now when validateRequest=false the textbox of establishment the error
does not occur except that the textbox of establishment return
the html codes of the postback by ajax
when i included the label control of establishment and tested it
on edit mode the same thing happens with label control of establishment
except that it does not return, it now has javascript error so
textbox control of establishment does not load too
-- modified at 15:18 Tuesday 18th July, 2006
|
|
|
|
|
right now my alternative solution is
with validateRequest=true in page directive (just remove)
and in javascript code i detect if
the postback value has more than 50 chars
since establishment textbox has maximum of 50 char
or it has script tags found which is not needed
coz validateRequest=true
i use a session variable instead
----
function Cbo_Complete(responseText, responseXML)
{
if( responseText.length == 0)
{
document.getElementById('txtEstablishment').value = '';
}
else
{
if( responseText.length > 50)
{
document.getElementById('txtEstablishment').value = '<%=Session["OriginalEstablishment"].ToString()%>';
document.getElementById('txtEstablishment').readonly=true;
}
else
{
document.getElementById('txtEstablishment').value = responseText;
document.getElementById('txtEstablishment').readonly=false;
}
}
}
if anybody has other solutions it would be a great help
thx
-- modified at 16:17 Tuesday 18th July, 2006
|
|
|
|
|
Hello!
It is an asp access based web site. The entries in the asp pages have entered in Turkish and there is no problem displaying the turkish characters in asp pages. However, when I record the entry in to access database file and then re-open the file, I have seen different ascII characters instead of Turkish characters.
Is there a way to see exact turkish characters in the access database file.
Thank You!
Bedri
|
|
|
|
|
what is .ashx in asp .net
dasdfsadfvasdcvasd
|
|
|
|
|
The file ending with the .ashx is used to create a custom http handler in the ASP.NET.
|
|
|
|
|
I've changed VS-2003 to VS-2005. Earlier, after button pressing in Web-Applicarion, I could indicate some program code. For example, I could write down for a form call:
Form2 f= new Form2();
f.Show(this);
Now, in VS-2005, it does not work. When I am pressing a button, VS-2005 for some reason sends me into javascript environment. But I do not want Java, I want, for example, open a data base.
1) How can I now code some useful things by a button pressing?
2) How can I now call a form from the current form?
HilSoft
|
|
|
|
|
Are you maybe setting the onClientClick event rather than the onClick event? Is your button marked runat="server"?
|
|
|
|
|
No, my button is not marked as runat="server"
HilSoft
|
|
|
|
|
ah, it's the little things in life...
|
|
|
|
|
Now I've understood. I has been taken the button from the HTML palette, and this is a fault in the case. You shold take a button from a usual FORM-palette, and then it works correcty! The reaction is shown in *.cs listing, when you can code. (Thanks to the Russian master Gaidar Magdanurov <gaidar.magdanurov@gmail.com>)
The question is closed.
HilSoft
|
|
|
|
|
Hi
I'm stuck with this data entry page in asp which I haven't programmed and it has some problems. this page inserts records into three different tables (SQL database).
The page has the insert statement starts with insertsql = "DECLARE @UserID int" followed by the insert statements. This id is inserted into the three tables as a primary key that connects them. the problem is that I'm trying to pass this id to another page which retrieves data according to this id. I'm already a beginer in ASP and I tried many times to declare a variable that can handle this ID and pass it through a session to the other page, but still nothing is working.
Is it possible to capture this variable UserId from the sql insert statement? if not what other ways can i solve this issue?
|
|
|
|
|
Could you just add a select at the end of the three insert statements, e.g.:
SELECT @UserId
And then set an asp variable to the return recordset value...
|
|
|
|
|
Which runs faster? ASP or JSP? I ve these two options - performance wise..
|
|
|
|
|
On today's computers and with the JVM's out there today, I'd say both run about equally as fast. Personally, I like JSP when I'm running my own server (running tomcat). If you are using a hosting company to host your site, I'd definately use asp. Unless you want to spend quite a bit of money, most of your java hosts use a shared VM for your site, and they are not very much fun to work. Otherwise, I'd say both perform about equally performance wise...it just comes down to language preference then.
Brian Van Beek
Inside this room, all of my dreams become realities, and some of my realities become dreams. -Willy Wonka
Read my Blog, I know you want to... [^]
|
|
|
|
|
hi
As i penetrate deeper into the "Secrets" of Web Development, i am somewhat confused about the Database backend of my web applications.
I suppose I am looking for a tutorial that will combine the three Elements i posted in the Subject.
Maybe i am just blind, but i have done quite a lot of searches, and can not seem to find a tutorial that will cover the basics of SQL, DAL, BLL, and the idea behind them.
Maybe someone could summ up in this topic, or better jet post a link to an exsisting tutorial that will cover the follwing aspects:
-Database Design (What Datatype for wich field an why, relationships of tables, views, storedprocedures, complex Select statements (select within another select?)
- Data Access Layer - why do i need it, what are the pros/cons, how do i do it? are there Industry Standards? what are they?
- Buissness Logic Layer - (same idea as the DAL) why do i need it - how else could i do it...
i am sure this would not only help me, but also very many other people out. The tutorials i have found so far, seems to go into detail on the individual subjects quite quickly and dont seem to just give an overview of the entier idea behind the system.
~Skyruner2
|
|
|
|
|