|
Sonia Gupta wrote: OnClick="validation();" />
If you are using ASP.NET 2.0, replace onclick with onclientclick . If your version is 1.1, the go with attributes.add("OnClick","function();") .
If you specify onclick like what you specified now, ASP.NET will think it is a server side function and will look for it's references that leads to the error.
|
|
|
|
|
thanks navaneeth.....
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
function validation()
{
if(document.Form1.txtfirstname.value=="")
{
alert("Please fill the First name");
document.Form1.txtfirstname.focus();
return false;
}
in page load
btnaccept.Attributes.Add("onclick", "return validation();")
jai prakash
|
|
|
|
|
Your best solution is here.
Use OnClientClick instead of OnClick event
i.e
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return validation();" />
and Javascript
<script language="javascript" type="text/javascript">
function validation()
{
if(document.Form1.textbox1.value=="")
{
alert("please fill it");
return false;
}
}
</script>
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
still same situation...
messagebox is not showing up.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
try By this condition <code>if(document.GetElementById('textbox1').value=="")</code>
Best regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
<script language="javascript" type="text/javascript">
function validation()
{
if(document.GetElementById("textbox1").value=="")
{
alert("please fill it");
return false;
}
}
</script>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not Page.IsPostBack) Then
Button1.Attributes.Add("OnClientClick ", "return validation();")
End If
End Sub
still messageox is not showing up...
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Sonia Gupta wrote: Button1.Attributes.Add("OnClientClick ", "return validation();")
Button1.Attributes.Add("OnClick ", "return validation();")
|
|
|
|
|
no....
still same problem...
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
try it <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return validation();" />
and remove this line
Button1.Attributes.Add("OnClientClick ", "return validation();")
Best regard
pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Imran.....still same problem
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Sonia Gupta wrote: document.GetElementById("textbox1").value
document.getElementById("textbox1").value
|
|
|
|
|
i am using 2005 .
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
jase lika hun wase likhna ok
function validation()
{
if(document.form1.TextBox1.value=="")
{
alert("please fill it");
}
else
{
alert(document.Form1.TextBox1.value);
}
}
page lode pe
Button1.Attributes.Add("onclick", "return validation();")
(case sensitive ka dikat tha dear)
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
have u done
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
HI.
U can use
Button.Attributes.Add("onClick","function();");
but out of Ispostback
U can also call javascript function by onclientClick event in source code
If u call by Onclientclick plz remove code from codebehind file.
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
in windows apllication, i want to select table's data and show it in datagrid
but i dont undertand how will i bind the data
is there any way to use datagrd view manager or something like this????
m confused!!!
$h@ma!|@
|
|
|
|
|
execute SQL statement.....and fill a DataSet with your information
if you use ACCESS as a database and VB.NET as your language then follow...
Dim mySql AS String="SELECT * FROM myTable"<br />
<br />
Dim ds As DataSet<br />
Dim da As OleDbDataAdapter<br />
<br />
da = New OleDbDataAdapter(mySql, myConnection)<br />
ds = New DataSet<br />
da.Fill(ds)<br />
<br />
DataGrid1.DataSource=ds
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
well! isnt there any need to use data reader??
well my code is
//connection as conn
strQuery = " SELECT * FROM table";
SqlCommand com1 = new SqlCommand(strQuery, conn);
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter();
SqlDataReader dr = com1.ExecuteReader();
if (dr.Read())
{
da.Fill(ds,"table");
}
its not working i mean data is not displaying in the grid..and the exception that is shown is
"The SelectCommand property has not been initialized before calling 'Fill'."
$h@ma!|@
|
|
|
|
|
why are u using datareader and dataset simultaneously???
follow this...
'1. Create a connection<br />
Dim myConnection as New SqlConnection(<br />
ConfigurationSettings.AppSettings("connectionString"))<br />
<br />
'2. Create the command object, passing in the SQL string<br />
Const strSQL as String = "SELECT * FROM myTable"<br />
Dim myCommand as New SqlCommand(strSQL, myConnection)<br />
<br />
'Set the datagrid's datasource to the datareader and databind<br />
myConnection.Open()<br />
DataGrid1.DataSource = myCommand.ExecuteReader(<br />
CommandBehavior.CloseConnection)<br />
DataGrid1.DataBind()
but keep in mind
A datareader is a read-only object. If you need to edit and update changes you need to use a dataset.
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
hmmmm but as i told i m working in windows application and it doesnt support databind option
is there any replacement or any directives/namespaces to include?
and what if i want to update records using dataset?
$h@ma!|@
|
|
|
|
|
waiting for ur answer
$h@ma!|@
|
|
|
|
|
sorry shamaila I have forgotten that yours a windows application...
then you have to make a datatable with that datareader and bind it to the datagrid....
i dont see any other option for you..
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
Here is a databind for a grid view in windows application:
//...
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
string strQuery = "SELECT * FROM tableTest";
SqlCommand com1 = new SqlCommand(strQuery, conn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(com1);
da.Fill(ds, "table");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "table";
//...
I hope it works...it worked when I've tested it
|
|
|
|
|
thx alot it really worked
so nice of u...and m feeling sorry as i found ur reply too late
$h@ma!|@
|
|
|
|