|
Add something like this to your form tag:
onsubmit="return CheckMe(this)"
and have a corresponding javascipt function check the conditions you want, eg
function CheckMe(f) {
var lastName = f.txtLastName.value;
if (lastName.length == 0) {
alert("Please give your last name");
return false;
}
var address = f.txtAddress.value;
if (address.length == 0) {
alert("Please give your address");
return false;
}
return true;
{
|
|
|
|
|
I'm building a simple content management system in asp.net and I've put together a web user control (called "contentpanel") to display a panel of content in the page.
What i want to be able to do is enumerate the number of these controls that appear in a given page so that my content management application can interrogate a given page in a site and know how many blocks of content it needs to present for editing.
So, what i've been trying to do is put together a webservice that will sit in my web application, take a parameter of the web page name, work out what class the page relates to, and then return the number of "contentpanel" controls in that page.
I've got most of the way with this using the following code:
<br />
Public Function PanelsInPage(ByVal PageName As String) As integer<br />
<br />
'Set up a variable to hold the number of contentpanels<br />
Dim PanelCount As Integer = 0<br />
<br />
'Get a reference to the assembly for the site<br />
Dim ThisAssembly As Assembly = System.Reflection.Assembly.GetExecutingAssembly<br />
<br />
'Loop through all classes looking for the PageName supplied<br />
Dim tClass As Type<br />
For Each tClass In ThisAssembly.GetTypes<br />
<br />
If tClass.BaseType.Name = "Page" And PageName = tClass.Name & ".aspx" Then<br />
<br />
<br />
End If<br />
<br />
Next<br />
<br />
Return PanelCount <br />
<br />
End Function<br />
<br />
The bit I'm struggling with is the middle of the If statement. I can identify the class, but I can't seem to find a way to enumerate the number of contentpanels that it contains. I've been using system.reflection, but I can't seem to pin down the right approach.
Is this even possible? Can a web user control be reflected from its containing page in this way? if so, can someone come up with some sample code for me (vb.net would be appreciated!)?
|
|
|
|
|
Sorry for bumping, but has anyone got any ideas on this for me?
Thanks.
|
|
|
|
|
Hello
I am developing an application in asp.net using c#.
When user open PDF file,it should go to the specific Page Number.
e.g When if I am passing Page No. 7 ,then file should open at Page Number 7.
I tried this using iTextSharp.But this can be done at the time of creating file through 'PdfAction.gotoLocalPage'.
But I want this to be apply on existing pdf.I don't want create it again and again because I want this process several times.
Please let me know if someone knows.
Swapnil Bhavsar
|
|
|
|
|
Hi,
I needed an Outlook-like calendar in my asp.net page and I found some source such as DayPilot but I am having problem to get it connect to my mssql.
I know I should ask them instead of here but since I found it through codeproject, I was wondering whether there is someone encounter this before and know the solutions or any other way to embed Outlook calendar into the asp.net page.
Thanks in advance.
J Liang
|
|
|
|
|
Hello
I have Web Service with two functions:
[Webmethod]
public string WinAuthHelloWorld()
{
return "WA : Hello world"
}
[Webmethod]
public string BasicAuthHelloWorld()
{
return "BA : Hello world"
}
In IIS I turn on the checkboxes "Integrated windows authentication" and "Basic Authentication".
In my client application I wrote:
// Main is static
static void Main()
{
Console.Write(CallBasicAuthHelloWorld());
Console.WriteCallWinAuthHelloWorld());
}
private string CallBasicAuthHelloWorld()
{
NetworkCredential netCredential = new NetworkCredential("domainname\username", "password");
Uri uri = new Uri(service.Url);
ICredentials credentials = netCredential.GetCredential(uri, "Basic");
service.Credentials = credentials;
service.PreAuthenticate = true;
return service.BasicAuthHelloWorld();
}
private string CallWinAuthHelloWorld()
{
Uri uri = new Uri(service.Url);
service.Credentials = = System.Net.CredentialCache.DefaultCredentials;
return WinAuthHelloWorld();
}
In invocation BasicAuthHelloWorld function I got Error 401 : Unauthorized.
What I dismiss in my code?
Thanks
|
|
|
|
|
Hi
I have a problem with regular expressions in javascript. I wrote the following function to check matching.
function CheckMatch(Pattern,subject){
var Flag = true;
var myregexp = new RegExp(Pattern);
if ( subject.match(myregexp) ) {
Flag = true;
} else {
Flag = false;
}
return Flag;
}
and my function call is like this. I am trying to get a match of all characters in between a-z and A-Z. If any other characters entered, it should return false .
CheckMatch('/[a-zA-Z]*/',"*&^^&")
But it is not giving me the expected result. Is anything missing in javascript function or in Regular Expressions ?
|
|
|
|
|
i m creating a data adapter but is not working..is it the correct way??
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);
da.Fill(ds, "table name");
$h@ma!|@
|
|
|
|
|
yes it should be right.
what's the error?
|
|
|
|
|
Error 1 The best overloaded method match for 'System.Data.OleDb.OleDbDataAdapter.OleDbDataAdapter(string, string)' has some invalid arguments
Error 2 Argument '2': cannot convert from 'System.Data.SqlClient.SqlConnection' to 'string'
$h@ma!|@
|
|
|
|
|
if u provide ur data binding function.it wil be easy to rectify it.
|
|
|
|
|
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);
conn.Close();
DataSet ds = new DataSet();
da.Fill(ds, "table name");
searchgrid.DataSource = ds.DefaultViewManager;
$h@ma!|@
|
|
|
|
|
try this one
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);
conn.Close();
DataSet ds = new DataSet();
da.Fill(ds, "table name");
searchgrid.DataSource = ds;
searchgrid.databind();
|
|
|
|
|
Sonia Gupta wrote: conn.Close();
DataSet ds = new DataSet();
da.Fill(ds, "table name");
Is it possible to fill DS when connection is closed ?
|
|
|
|
|
u shd decleare the namespace System.Data.OleDb.OleDbConnection
|
|
|
|
|
$h@ma!|@ wrote: OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);
What is the type of conn ? OledbDataAdapter is having 4 overloaded methods.
1. public OleDbDataAdapter ( System.String selectCommandText , System.Data.OleDb.OleDbConnection selectConnection )
In this you need to pass the select query and OledbConnection object as parameters
2. public OleDbDataAdapter ( System.String selectCommandText , System.String selectConnectionString )
In this pass Query and connection string
3. public OleDbDataAdapter ( System.Data.OleDb.OleDbCommand selectCommand )
This accepts OledbCommand object
and last one is with no parameters. Check your call matches with these methods ?
|
|
|
|
|
ok fine i'll try thx
$h@ma!|@
|
|
|
|
|
Hi i posted this msg already...,
Our members also said some answers...,
But still i didn t get proper answer...,
So,I am post one more time...,
Plz give me some solution for this probs...,
I am trying to display my grid cell value in grid textbox...,
So i used this following code...,
For Each fillgrdregtextbox As DataGridItem In dgrdmain1.Items
Dim AppRgHrs As TextBox = CType(fillgrdregtextbox.FindControl("txtAppRgHrs"), TextBox)
Dim AppOtHrs As TextBox = CType(fillgrdregtextbox.FindControl("txtAppOtHrs"), TextBox)
If fillgrdregtextbox.Cells(25).Text <> "" Then
AppRgHrs.Text = Val(fillgrdregtextbox.Cells(25).Text)
AppOtHrs.Text = Val(fillgrdregtextbox.Cells(26).Text)
ElseIf fillgrdregtextbox.Cells(27).Text <> "" Then
AppRgHrs.Text = Val(fillgrdregtextbox.Cells(27).Text)
AppOtHrs.Text = Val(fillgrdregtextbox.Cells(28).Text)Else
AppRgHrs.Text = 0
AppOtHrs.Text = 0
End If
Next
In this that first if condition is working...,
But that elseif is not working...,(Mentioned in bold)
Instead of that i am getting 0 on there...,
how to solve it...,
Plz tell me...,
Advance thanks...,
Regards,
Magi
|
|
|
|
|
Is the 27th column is BoundColumn or template column? The Text property would be always empty in the TemplateColumn.
|
|
|
|
|
27th is the bound column...,
Regards,
Magi
|
|
|
|
|
I am in the middle of an application where i am using ASp.net with Ajax controls..
I want to pop a value from the gridview, when i click it and to be displayed in the cascading drop down list..
there are two dropdown lists, first one works fine always... the second one gets enabled only when i select values in first..
the gridview value i click pops in to the first dropdown but not to second one...
The code i used is
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(ds_rec.Tables[0].Rows[0]["Column1"].ToString()));
i need help
thanks in advance....
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|
|
What's the use of Master page in asp.net 2.0
Is it related to like MDI parent form in window application.
|
|
|
|
|
master page is like paretnt page
the layout in master page will automaticaaly appear to all child pages..the only different thing will be content place holder
$h@ma!|@
|
|
|
|
|
if we want same header footer and and any thingh in ui in deferent page then it help
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
if u please provide a suitable link..?
Thanks..
Sonia Gupta
soniagupta1@yahoo.co.in
|
|
|
|