|
Hope this could be of some use to you parameter inside search() statement are few regular expression which you can use.
Validations using Search () Method
1. search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) :- E-Mail Field.
2. search(/^\w+((-\w+))+$/) :- Matches the occurrence of only hyphen (-) between alphanumeric values.
Eg :- Only comm-it, shujaat-khan etc. are valid only between two words.
3. search(/^\w+((\.\w+))+$/) :- Matches the occurrence of only Fullstop (.) between alphanumeric values.
Eg :- Only comm.it, shujaat.khan etc.
4. search(/^\w+((_\w+))+$/) :- Matches the occurrence of only Underscore (_) between alphanumeric values.
Eg :- Only comm_it, shujaat_khan etc.
5. search(/^\w+((\W\w+))+$/) :- Matches the occurrence of only Blank Space between alphanumeric values.
Eg :- Only comm it 123, shujaat ullah khan etc.
6. search(/^[0-9]+\.+([0-9]+)+$/) :- Matches the occurrence of only decimal values.
Eg :- Only 22.200, 39.9786 etc.
7. search(/^[0-9]+$/) :- Matches the occurrence of only numeric values.
Eg :- Only 22200, 399786 etc.
8. search(/^[A-Za-z]+$/) :- Matches the occurrence of only Alphabets values.
Eg :- Only shujaat, commit etc.
9. search(/^([A-Za-z]+[A-Za-z0-9]+$)|^[A-Za-z]+$/) :- Matches the occurrence of an Alphabet in beginning and the
others being alphanumeric values.
Eg :- Only shujaat, commit etc.
10. search(/^[A-Za-z]+[\WA-Za-z]+$/):- Matches the occurrence of only Spaces between alphabets.
Eg :- Only comm it, shujaat khan etc.
Shujaat
|
|
|
|
|
Where I have to use this Search method and how I have to use this search method.Since Iam new to this please explain me
Priya
|
|
|
|
|
If you are writing a javascipt for validation you can use search method.
as if variale xyz contain the text to be validates then use
xyz.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)
However if you are using vaildation control then just copy the regular expression in search method which suits your requirement and set it in validation control.
Shujaat
|
|
|
|
|
As the subject reveals, I'm trying to access an ImageField programmatically in order to set the image according to the business object.
In the RowDataBound event handler, I have:
<br />
protected void MessagesGridView_RowDataBound(object sender, GridViewRowEventArgs e)<br />
{ <br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{<br />
ImageField theImage = (ImageField)e.Row.Cells[0].Controls[0];<br />
But I get a "[...] Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ImageField' [...]"
I've searched like mad, but I can't see what I'm doing wrong.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Please try this........
ImageField theImage = (ImageField)e.Row.Cells[0].FindControl("imageFieldID");
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Thanks for your suggestions; unfortunately it gives the same compiler error.
I "solved" the issue by simply adding an Image control to the ImageField's cell's control collection. Not very clean, but it works.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
g'day folks,
i'm having a small issue with regards to custom event handlers in my web service. I'm trying to create a custom event handler whose purpose is to display messages on the web form as a particular method is executed via the web service. For instance, lets assume that the web method generates a report from a database then my eventhandler would update on the web form indicating which aspects of the report has been generated.
Initially I thought let's do it the standard way as you would in a standard console application as follows:
public delegate void ReportGenerationProgressEventHandler(string x);
public event ReportGenerationProgressEventHandler myReportGenerationHandler;
The above can be instantiated as follows:
myReportGenerationHandler+= new ReportGenerationProgressEventHandler (Service_myReportGenerationHandler);
In my webservice if I just declare the delegate and event types as above. Then instantiate an object of my webservice in the webform I do not get an option to create my report progress eventhandler via intellisense.
I have tried google but most disscusions tends to be focused on custom events for custom controls unless I go write a custom control which I think will not be appropriate in my case at all.
Is there an alternative method of achieving the same result in asp.net ?
thanks
edit: mistake in code
|
|
|
|
|
Just to answer my own question and for anyone else's benefit.
Well it seems that web services in .net doesnt support eventing even though there is a specification,[^] , from the W3C committee that web services should support eventing. The only other option will be to use WCF however platform compatability will be an issue.
|
|
|
|
|
Hi.
I'm using ASP.NET 2.0 and MS SQL Server 2005 environment. I'm developing an aspx page which is using DetailsView to insert data.
There are several TemplateFields are located at the DetailsView control. These Template fields containing TextBox and DropDownlList controls and I'm passing values of these controls using %Bind% syntax:
<asp:DetailsView ID="dvCity" runat="server" AutoGenerateRows="False" DataKeyNames="Id"
DataSourceID="sdsCity" DefaultMode="Insert" OnItemInserted="dvCity_ItemInserted">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True"
SortExpression="Id" Visible="False" />
<asp:TemplateField HeaderText="Name">
<InsertItemTemplate>
<asp:TextBox ID="txbName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="txbName" SetFocusOnError="true"
Display="Dynamic" ErrorMessage="You must specify a non-blank value for Name.">*</asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RegionId" HeaderText="RegionId" SortExpression="RegionId"
Visible="False" />
<asp:TemplateField HeaderText="Region">
<InsertItemTemplate>
<asp:DropDownList ID="ddlRegion" runat="server" DataSourceID="sdsRegion" DataTextField="Name"
DataValueField="Id" SelectedValue='<%# Bind("RegionId") %>'>
</asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
DataSource for the DetailsView is the SqlDataSource which is using StoredProcedures to insert data into Database.
Some parts of business logic are located in the T-SQL code of the StoredProcedure and in case of any error I'm throwing exception from T-SQL using RAISE_ERROR method.
In the aspx.cs, OnItemInserted event of the DetailsView I've implemented following code for exception processing:
protected void dvCity_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
if (e.Exception != null)
throw e.Exception;
else
Response.Redirect("City.aspx");
}
When there is no error during StoredProcedure execution everything is works fine.
When my StoredProcedure raises any exception and this exception was handled by my handler user sees the AJAX popup and clicks OK.
Then popup closes, user edits values in DetailsView controls, clicks Save again BUT I got another exception saying that ((TextBox)dvCity.FindControl("txtName")) is NULL. The same is for DropDownList.
It seems to me that DetailsView loses databinding after an exception occurs during Insert/Update operation.
<b>Does anyone can help me how to handle or re-throw exception without DetailsView unbind?</b>
http://www.jetideas.com
|
|
|
|
|
Hi,
i would like to trace my code using breakpoints,
but its not working,while running appln,
even i checked properties in "debug" tab-all breakpoints enabled,
also tried with <trace="true">Please suggest me...
Thanks&Regards,
Priya.
|
|
|
|
|
I think you are running your project in release mode. Make as debug mode. See in toolbar you have found it.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
changed to debug mode, not tracing.
Thanks&Regards,
Priya.
|
|
|
|
|
Build one more time and check the mode in which your application is running
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... "
|
|
|
|
|
tried all sorts of mode, of no use.
Thanks&Regards,
Priya.
|
|
|
|
|
are you debuging the rig ht application ?
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... "
|
|
|
|
|
This sometimes happens in case of more than one worker process check the number of worker process running in task Manager
Shujaat
|
|
|
|
|
i hv checked it, only one process running, but still not tracing
Thanks&Regards,
Priya.
|
|
|
|
|
In visual studio go to Build --> Configuration Manager This will open the Configuration Manager Window
In the Active solution Configuration dropdown Select debug
Now check in the project column that the configuration selected for your project is debug and not release or any other. If it is any other change it to debug.
Shujaat
|
|
|
|
|
Hi there,
Anyone gone through deployment process in ASP 2.0. Please educate me on this - I want my site updatable (I know how to do that) but compile and deploy process always complies all the files - now how do I know what all dll and source code has been changed on my last build. This is more related to tracking changes in VSS or any config mgmnt s/w - I just want to update one aspx and get one dll for it (I have congigured build-deployment as one dll for each as*x), I couldn't find any info on this aspect, please let me know how to achieve the goal. Even if I have one dll as output for the website with updatable aspx/ascx (using web deployment project) it gives me all the aspx complied with latest datetime stamp, so if I don't keep track of what all files I modified - I have to deploy entire website again. Instead it should be something like I changed 5 aspx, got them complied, and deployed the modified aspx plus new dll - I don't find a proper way...please guide.
Pankaj No.1
|
|
|
|
|
I need to access a textbox in a insertItemTemplate in a formView control to increment a primary key.
thanks for ur help.
BiG RaLpH
|
|
|
|
|
i didnt get u but i think this what u want....
TextBox txtBox=(TextBox)GridView1.Rows[Index].Cell[Index2].FindControle("TemplateFieldName");
|
|
|
|
|
Thx ahmad
But I really know how to do that I want it in the formview control not in the grid view control.
Thx anyway for ur answer.
BiG RaLpH
|
|
|
|
|
Hi,
Currently i'm developing a web based app. In one of the page i need to generate and show some data in excel.
I have added Excel 11.0 as a reference and using the following declarations:
Excel.Application ExcelApp = null;
Excel.Workbook ExcelWorkbook = null;
Excel.Worksheet ExcelWorkSheet = null;
and i'm using it as below
ExcelApp = new Excel.Application();
ExcelWorkbook = (Excel.Workbook)(ExcelApp.Workbooks.Add(Type.Missing));
ExcelWorkSheet = (Excel.Worksheet)ExcelWorkbook.Sheets["Sheet1"];
and it works fine.
But when i use the code below i'm getting compile time errors and for the below im not referring to Excel 11.0 library.
using Microsoft.Office.Tools;
using Microsoft.Office.Tools.Excel;
using Microsoft.Office.Interop.Excel;
The above three lines are written at the namespace declaration section.
Application ExcelApp = null;
_Workbook ExcelWorkbook = null;
_Worksheet ExcelWorkSheet = null;
ExcelApp = new Application();
ExcelWorkbook = (_Workbook)(ExcelApp.Workbooks.Add(Type.Missing));
ExcelWorkSheet = (_Worksheet)ExcelWorkbook.Sheets["Sheet1"];
One more problem is now the above codes fail to compile in machines in which their counter compile. Can any one help me on this.
Thanx,
PLS
|
|
|
|
|
Application is a property which refers to the application of page one cannot make an object of it.
Can you plz tell me what reference are you using for these name spaces I mean which library are you using?
using Microsoft.Office.Tools;
using Microsoft.Office.Tools.Excel;
using Microsoft.Office.Interop.Excel;
Shujaat
|
|
|
|
|
When I add new item to ASP.Net 2.0 project Iam having Javascript file but not VB Script File where I will get this or how this can written in Notepad
Priya
|
|
|
|