|
I'm trying the following in a code behind subroutine, and it's not working. If the value they select is CORRECT, the exeption is still thrown.
txtWPMgr.Text should get built from a SQL string the does a select colName+' | '+colNumber
It's the colNumber value I want to compare in this expression.
Dim regEx As New Regex("^\s\w\s\d{6}$")
'last six characters are digits
If Len(Trim(txtWPMgr.Text)) > 0 Then
'Means there are characters for the name
If InStr(txtWPMgr.Text, " | ") = 0
Or Not regEx.IsMatch(Trim(txtWPMgr.Text)) Then
intDisable = 1 'Mark integer flag
lblStatus.Text = "Bad Format!"
End If
|
|
|
|
|
I got it with:
'Start Expression Code
Dim regEx As New Regex("\s\|\s\d{6}$") 'last six characters are digits for number
If Len(Trim(strNewPerson)) > 0 Then 'Means there are characters for the name
If InStr(strNewPerson, " | ") = 0 Or Not regEx.IsMatch(Trim(strNewPerson)) Then
lblStatus.Text = "* Name value must be from dropdown list built when typing name(last name first)!"
Exit Sub
Else
lblStatus.Text = String.Empty
End If
End If
'End Expression code
Thanks!
|
|
|
|
|
You have forgotten to specify how many characters of each you allow.
Now you are matching a single white-space character, a single alphanumeric character, a single white space character and six digits.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa,
That's all I want to allow:
a single white-space character, a single alphanumeric character, a single white space character and six digits
|
|
|
|
|
I thought that you had a string in the format "Smith Jonathan R | 888999"?
---
b { font-weight: normal; }
|
|
|
|
|
Guffa,
Thanks for staying with this.
Yes, my string is something like:
"Bush George W | 987987"
...and I thought this would/should do the trick to make sure the end of my string is correct:
Dim regEx As New Regex("\s\|\s\d{6}$")
...am I missing something?
What I don't want someone to do is allow users to take "Bush George W | 987987" and make it :
"George W Bush" or
"Bush George W" or
"Bush George W | 987"
|
|
|
|
|
Yes, in that case that pattern works.
It's wasn't that pattern you used in the message I replied to, though.
---
b { font-weight: normal; }
|
|
|
|
|
hi all
I have a big problem :
======================
1)- after i setup (windows 2003 server) and (the iis) and (VS.net 2003)
on my computer i found that problem .
2)- this problem i found it only when i use (ASP.net Web.App VB)
But the (Windows App work very good) when i change the
( Regional and language date formate to dd/mm/yyyy ).
* I can not made any change in ( Date formate MM/dd/yyyy ) from the
(Regional and language )this problem i found it only when i use
(ASP.net Web.App VB).
* I want to change the date format to (dd/mm/yyy) at my (WEB APP VB.NET).
* some one tell me i must format my hard and reinstall the windows and all
other app agin is this a solution !!!!!!!!!!! .
pls help my
thank you all
sigh:
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
I have created a User Control with 4 Link Buttons, which I intend to use on different WEB Pages. I need to expose the Click Event of these Link Buttons as they do different task on different Web Pages.
I have no clue on how to expose the click events of these Link Buttons
on the user Control I have created.
Does some one have a suggestion on how to accomplish this. I am using VB as my code behind
|
|
|
|
|
Hi there. Here is a simple example of a user control that fires events. The first file is a user control, the second is an .aspx page that consumes it. I hope this is helpful.
file events2_uc1.ascx:
<%@ Control language="VB" %>
<script runat="server">
public event OKClicked as EventHandler
public event CancelClicked as EventHandler
Protected Overridable Sub OnOKClicked(args as EventArgs)
RaiseEvent OKClicked(Me, args)
End Sub
Protected Overridable Sub OnCancelClicked(args as EventArgs)
RaiseEvent CancelClicked(Me, args)
End Sub
Private Sub btnOK_Click(o as Object, e as EventArgs)
OnOKClicked(new EventArgs())
End Sub
Private Sub btnCancel_Click(o as Object, e as EventArgs)
OnCancelClicked(new EventArgs())
End Sub
</script>
<asp:Button id="btnOK" runat="server" text="OK"
OnClick="btnOK_Click"
/>
<asp:Button id="btnCancel" runat="server" text="Cancel"
OnClick="btnCancel_Click"
/>
file events2.aspx:
<%@ Page Language="VB" %>
<%@ Register TagPrefix="uc" TagName="Buttons" Src="events2_uc1.ascx" %>
<script runat="server">
Sub OKClicked(o as object, e as EventArgs)
label1.Text = "The OKClicked event was fired in the user control"
End Sub
Sub CancelClicked(o as object, e as EventArgs)
label1.Text = "The CancelClicked event was fired in the user control"
End Sub
</script>
<html>
<head>
<title></title>
</head>
<body>
<form runat="server">
<h3>Testing events from a user control</h3>
<hr />
The following is a user control:
<br />
<uc:Buttons runat="server"
OnOKClicked="OKClicked"
OnCancelClicked="CancelClicked"
/>
<br /><br />
<asp:Label id="label1" runat="server" text="" />
</form>
</body>
</html>
|
|
|
|
|
Like this:
http://www.samspublishing.com/articles/article.asp?p=23020&rl=1
|
|
|
|
|
Why Application_PostAuthenticateRequest and Application_AuthenticateRequest events happen twice ? When I put a breakpoint in their code I see that when I run the application they are called twice ? Can someone tell me why they have to be called twice ? Illustrating their position in the asp.net's events flowchart will be helpful . Help me please .
|
|
|
|
|
Hi,
In my project,due to large number of records a stored procedure is taking more time to return the records.But before that the connection time expires and the module will show the error message.Since the project is deployed in the site we cannot recompile after code change.Is there any way to set in web.config to get more sql connection time.
Please show me the right way..Thanks much in advance.
Thank You,
RPM.
|
|
|
|
|
You can set the CommandTimeout[^] property of your SqlCommand object to a higher number before executing.
|
|
|
|
|
Hi Mike Ellison,
Thanks a lot for the reply and information.But this requires code change.Our project is deployed in the production server.So without a code change and only change in web.config can we incorporate this?
Any possibility is there?
Thanks very much,
RPM.
|
|
|
|
|
Well, you can always store values in AppSettings in your web.config, then read those values in your application... granted, that involves a code change initially, but after that then you can set your timeout values through web.config.
|
|
|
|
|
I have faced the similar problem in my application. To change the connection timeout property in the query string won't solve the issue. You have to change on the code, imagine you are using an command object and executing a stored procedure, you have to set the CommandTimeout property of the command object to some time (Seconds). It is working for me. I tried with web.config connection timeout property of the connection string, it was not working.
Example:
========
SqlCommand oCmd = new SqlCommand("Procedure1", oConn);
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.CommandTimeout = 300;
SqlDataAdapter oAdp = new SqlDataAdapter(oCmd);
|
|
|
|
|
hi,
i have seen some of the datagrid samples in internet. In most of the cases the datagrid is bind to some table. But if i want to display the output of an sql query(contains select statement with n number of columns) in Datagrid, i can simply use AutogenerateColumns=true and populate the datagrid without having any bound columns. That is fine.
If i want to add some more extra columns like a checkbox column and an edit link button column i can do it using property builder. But,the problem is how can i order the columns in datagrid.
for example: 1st col: checkboxes
2nd-4th col : from sql statemnt
5th col : edit link button
Also how can i make a random column from sql statement to a hyperlink column.
thanks
|
|
|
|
|
One simplest way is, add few temprory columns in the query, wherever you want add column in the grid. Then bind that query result to the datagrid.
Example:
========
Actual query is,
select column1, column2, column3 from table1
Imagine you want to add columns in between 1 and 2, 2 and 3 then the query should be,
select column1, '' as tempcol1, column2, '' as tempcol2, column3 from table1
then on the itemdatabound event you can add any control like (button, linkbutton, or dropdownlist) on the column.
Ram
|
|
|
|
|
can you please explain a bit about the modified query.
|
|
|
|
|
Example:
========
Actual query is,
select column1, column2, column3 from table1
Imagine you want to add columns in between 1 and 2, 2 and 3 then the query should be,
select column1, '' as tempcol1, column2, '' as tempcol2, column3 from table1
then on the itemdatabound event you can add any control like (button, linkbutton, or dropdownlist) on the column
Explanation:
============
You just execute the these two queries. First query will return three columns, second query will return five columns. The temp columns are not available in any table, which will be used to create a column in the grid. You just execute this queries in the query analyzer and check.
Ram
|
|
|
|
|
Please help me to find a tool to convert barcode no. to picture in crystal report to print it
thanks for all
|
|
|
|
|
Does anyone know how the the HTTP Headers property 'Enable content expiration' set to Expires immediately can be programmed using C#?
Advance thanks for your reply
|
|
|
|
|
can any one plz,send me a good URL to learn SESSIONS,COOKIES from BASICS in ASP.NET using C#
|
|
|
|