|
Check out the ValidationGroup property (both on validator and submit button)
|
|
|
|
|
Hi All...
I have a form that adds users to the application, I use a submit button to add with event onClick_Button, when I insert all data in fields and then press enter, it does not add until I click on to the submit button, I want to know how to fire the onClick_button event when I click enter button,,
Thanks alot...
Nour Abdel-Salam
|
|
|
|
|
This is probably to do with how browsers handle submit buttons and forms. If there is only one submit button (and I mean an input with type="submit" on the client, whatever server-side controls you have) this should no problem, but if the button is rendered as type="button" or there is more than one this won't happen (although if theres more than one I think it fires the first....could be wrong).
Either the submit button isn't really rendering as a proper submit or you have more than one on your page.
|
|
|
|
|
Thanx for your response
My form has only 2 textboxes and a submit button (type submit)...
When I press enter, it does not insert the data, until i press the button by mouse...
regards
|
|
|
|
|
Can you post the markup code?
|
|
|
|
|
web.config is as under:
<configuration>
<configsections>
<appsettings file="objectAConfiguration">
web2.config is as under:
<configuration>
<configsections>
<objectaconfiguration
="" property1="70.00" property2="2.5" startingcost="257.20">
ObjectAConfiguration class is as under:
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Xml;
namespace MyApp
{
[Serializable]
public class ObjectAConfiguration:ConfigurationSection
{
#region Properties
[ConfigurationProperty("property1", DefaultValue = 60.00F)]
public float Property1
{
get { return (float)this["property1"]; }
set { this["property1"] = value; }
}
[ConfigurationProperty("property2", DefaultValue = 1.50F)]
public float Property2
{
get { return (float)this["property2"]; }
set { this["property2"] = value; }
}
#endregion
}
}
Problem Area is bellow:
MyApp.ObjectAConfiguration objAConf= (MyApp.ObjectAConfiguration)ConfigurationManager.GetSection("objectAConfiguration");
The above did not find the web2.config file and thus objectASection section.
Thanks.
|
|
|
|
|
Use the "Ignore HTML" option when posting markup code.
---
Year happy = new Year(2007);
|
|
|
|
|
Sorry! the site did not display my contents entirly and correctly.
web.config is as under:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="objectXConfiguration"
type="MyApp.ObjectXConfiguration, MyApp"
allowLocation="true"
allowDefinition="Everywhere"
/>
<section
name="objectZConfiguration"
type="MyApp.ObjectZConfiguration, MyApp"
allowLocation="true"
allowDefinition="Everywhere"
/>
</configSections>
<appSettings file="objectAConfiguration">
</configuration>
web2.config is as under:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="objectAConfiguration" type="MyApp.ObjectAConfiguration, MyApp"
allowLocation="true"
allowDefinition="Everywhere"
/>
</configSections>
<objectAConfiguration
property1="70.00"
property2="2.5"
startingCost="257.20"
/>
</configuration>
ObjectAConfiguration class is as under:
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Xml;
namespace MyApp
{
[Serializable]
public class ObjectAConfiguration:ConfigurationSection
{
#region Properties
[ConfigurationProperty("property1", DefaultValue = 60.00F)]
public float Property1
{
get { return (float)this["property1"]; }
set { this["property1"] = value; }
}
[ConfigurationProperty("property2", DefaultValue = 1.50F)]
public float Property2
{
get { return (float)this["property2"]; }
set { this["property2"] = value; }
}
#endregion
}
}
Problem Area is bellow:
MyApp.ObjectAConfiguration objAConf= (MyApp.ObjectAConfiguration)ConfigurationManager.GetSection("objectAConfiguration");
The above did not find the web2.config file and thus objectASection section.
Thanks.
|
|
|
|
|
Imports System.Data
Imports System.Data.OleDb
Partial Class Links
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("ID") = Nothing Then
Response.Redirect("default.aspx?flag=2")
End If
Dim conn As New OleDbConnection
Dim cm As New OleDb.OleDbCommand
Dim dr As OleDb.OleDbDataReader
HyperLink1.Enabled = False
HyperLink2.Enabled = False
HyperLink3.Enabled = False
Try
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC"
conn.Open()
cm.Connection = conn
cm.CommandText = "Select * From users where u_id=" & Session("id") & " "
dr = cm.ExecuteReader()
If dr.HasRows Then
Do While dr.Read
If dr.GetValue(7) = 1 Then
HyperLink1.Enabled = True
End If
If dr.GetValue(8) = 1 Then
HyperLink2.Enabled = True
End If
If dr.GetValue(9) = 1 Then
HyperLink3.Enabled = True
End If
Loop
dr.Close()
conn.Close()
Else
dr.Close()
conn.Close()
End If
Catch ex As Exception
Response.Write(Err.Description)
End Try
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New OleDbConnection
Dim cm As New OleDb.OleDbCommand
Dim dr As OleDb.OleDbDataReader
Try
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC"
conn.Open()
cm.Connection = conn
cm.CommandText = "Select * From types where t_name='" & TextBox1.Text & "' "
dr = cm.ExecuteReader()
If dr.HasRows Then
Do While dr.Read
Label1.Text = " نوع العقار موجود سابقاُ"
Label1.Visible = True
Loop
Else
Dim cm1 As New OleDb.OleDbCommand
cm1.Connection = conn
cm1.CommandText = "insert into types(T_Name) values('" & CStr(TextBox1.Text) & "') "
cm1.ExecuteNonQuery()
Label1.Text = "تمت الإضافة"
Label1.Visible = True
TextBox1.Text = ""
End If
dr.Close()
conn.Close()
Catch ex As Exception
Response.Write(Err.Description)
End Try
End Sub
End Class
|
|
|
|
|
As I said: "Could you post the markup code?"
|
|
|
|
|
hi
i want to upload a file(.doc,.jpg etc..) into a web server by clicking on the browse button and selecting the file path from the local machine i have to upload the file.
how can i do this (also how can i have the browse button ..so that when i will click over it it will open a dialouge box for file selection as usually in job sites where the user have to upload their cvs)i am using vb.net as code behind
thanks in advance
pradip kishore
|
|
|
|
|
Define the ID of file control as FileUpload then add a Button named as btnSubmit adn write the folowing code on the Button's onclick event
private void btnSubmit_Click(object sender, System.EventArgs e)
{
try
{
if (isVaildData())
{
if (FileUpload!=null)
{
string DestinationPath = Server.MapPath("../UpLoadFile/Images").ToString() ;
string ImgName =GetUniqueId()+ System.IO.Path.GetFileName(FileUpload.PostedFile.FileName);
ImgName = ImgName.Replace(" ", "");
string saveLoaction=DestinationPath+"\\"+ImgName;
FileUpload.PostedFile.SaveAs(saveLoaction);
Session["SavedFile"]=ImgName;
btnSubmit.Enabled=false;
btnRemoveFile.Enabled=true;
lblMessage.Text="File :" + ImgName + " Uploaded Successfully ";
lblMessage1.Text=ImgName;
Session["strFileType"]=Request.QueryString["Type"].ToString().Trim();
}
else
lblMessage.Text="Please Browse a File.";
}
}
catch(Exception ex)
{
string str=ex.Message;
}
}
rivate Boolean isVaildData()
{
if (FileUpload.PostedFile.ContentLength==0)
{
lblMessage.Text="Please Select an valid file";
return false;
}
if ( FileUpload.PostedFile.FileName!="" )
{
string filename=System.IO.Path.GetFileName(FileUpload.PostedFile.FileName.ToString());
string extension = System.IO.Path.GetExtension(FileUpload.PostedFile.FileName);
string Type = Request.QueryString["Type"].ToString();
switch(extension.ToLower())
{
case ".pdf":
break;
case ".doc":
break;
case ".jpg":
break;
case ".gif":
break;
default:
{
lblMessage.Text="Invalid Disclosures file :-" + FileUpload.PostedFile.FileName;
return false;
}
}
}
return true;
}
Neeraj
|
|
|
|
|
Hi Neeraj
thanks a lot for your vital support.
can you post a vb.net version of the code as i am using vb.net as my code behind..
thanks again
pradip kishore
|
|
|
|
|
Hi Neeraj
another small task for you
suppose i uploaded a file and i want to give a link of it for the user on a page.so how the user link can be automatically created on a user interface when i will upload a page..?
pradip kishore
|
|
|
|
|
i have a webform in which there are several textbox controls. i want that when i press the reset button all the textbox controls should be cleared..how can i do ths by looping through the textbox controls.. i am using vb.net as code behind
its urgent
thanks in advance
pradip kishore
|
|
|
|
|
You mean a reset button?
<input type="reset" value="Reset" />
|
|
|
|
|
Is it possible to make some of the DataGrid functionality to client-side? Such as the Edit, Update, Cancel, Delete functionality? Everytime I click on a row's Edit button, I wait 2 seconds before I see the Edit controls (eg. textboxes, drop-down combos, checkboxes). I understand that the DataGrid's Edit, Cancel, Update, Delete functions are server-side because it uses ASP.NET postback handler functions.
What I like is these Edit, Cancel, Update, Delete functions being on client-side, but uses AJAX requests in background. This would make the user feel fluid editing (opposed to the 2 seconds delay for each DataGrid button pressed).
Is this possible with the standard DataGrid? Or can the DataGrid be overrided so that the Edit, Cancel, Update, Delete functions operate on client-side, and sends the actual Update/Delete command using AJAX? This is so much faster and better than the current slow DataGrid.
If one has to code all this functionality manually, how would one go about it?
If I don't see much prospect of the DataGrid, I'll eventually abandon ASP.NET with GWT.
|
|
|
|
|
|
I am developing a contractors database system and the specs is that I must program in tiers. So how does this thing work because i am still learning
Karabo
|
|
|
|
|
wrote: I am developing a contractors database system and the specs is that I must program in tiers. So how does this thing work because i am still learning
You separate out the presentation, the business logic and the database access into separate assemblies (actually, you don't have to put them in different assemblies, but it helps you enforce the separation of tiers). The presentation layer can only talk to the business logic and the business logic can only talk to the database.
Various design patterns can help you achieve this. So, you might start by looking for books on design patterns. If you've never done any before then Head First Design Patterns is an excellent book - the code samples are in Java, but should be easy enough for anyone to understand.
|
|
|
|
|
|
Hi All
I am working with SQL Datasource thru program logic. I am fine till the time my stored procedure returns single result set. I can read the dataview and the return values also.
But how i can read values, if my SP return multiple result set? For exmaple
Select Name from table
Select webage from Table1
Any help,
Amit Gugnani
|
|
|
|
|
if you are using DataReader for getting resultsets then use DataReader's NextResultSet() method to move the next resultset
if you are using DataSet for getting resultsets then the resultsets available in the form of DataSet.Tables[0],DataSet.Tables[1],..DataSet.Tables[n], I mean Table Collection object
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
Is it better to use SqlDataSource in 2.0 ? Wht is ur view....
Because the power of sqldatasource is very impressive. I don't need to write any data datareader code, it can return dataset/data reader in form of dataview....
I am confuse, should i use this or not in my DAL layer. pl share your experience...
Thx
Amit
Thx
|
|
|
|
|
Yaa of cource you can use the SqlDataSource 2.0. New development is for more userfriendliness. And in the SqlDataSource 2.0 we have to do little to work. You should't use the SqlDataReader in any simple condition.
naresh patel
|
|
|
|