|
What are the 3 controls you are having and which one is creating trouble to you?
Arindam
|
|
|
|
|
Thanks for quick reply
Firh i am using Combo Box Control(Autopostback true). I wrote the following code which work fine(this code is to select service code and fetch from database corresponding max recordno and assign 1+ max record no to textbox1 )
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
{
setting = ConfigurationManager.ConnectionStrings["Databaseconnection"];
if (setting != null)
{
SqlConnection conn = new SqlConnection(setting.ConnectionString);
query = "select max(serialNO) from inquirydtl where serviceid = '" + DropDownList1.SelectedItem + "'";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
//TextBox1.Text = cmd.ExecuteScalar() + 1;
int i;
//SqlDataReader rdr = cmd.ExecuteReader();
if (cmd.ExecuteScalar().ToString().Equals(""))
{
TextBox1.Text = "000001";
}
else
{
TextBox1.Text = cmd.ExecuteScalar().ToString();
}
TextBox1.Focus();
}
}
Seond i am using Textbox(Autopostback) true .where i want to concatenate it with textbox1.text to generates inquiryid . check for its existnace but it does not work. In debug mode. flow does not go through it.even then i made corresponding TextBox1.AutoPostBack = true; in page load event what is problem. please help
regards
imran khan
|
|
|
|
|
The main point lies what I feel the way TextBox autopostback event reacts.
Basically a <asp:textbox> control can do a autopostback in 3 scenario
1. Ater entering all the character in textbox, if ENTER key is pressed.
2. Ater entering all the character in textbox, if TAB key is pressed.
3. Ater entering all the character in textbox, click anywhere outside of the Textbox.
Like drop down list TextBox cant just fire server side textchangedevent as you keep entering character from keyboard one by one. If you do the same it becomes a client side event that can be tracked using anyclientside event.( onkeypress, onkeydown ... like that)
So make sure that you are initiating the postback event of the Textbox, means you are performing either of the above mentioned activities.
Hope it will help you.
Arindam
|
|
|
|
|
thanks Arindam,
I think that i am just assainging database value(Not entering) to textbox that cuases problem. How can i make sure that even i assaign from database. code execute. please guide me
thanks once againe
regards
imran khan
|
|
|
|
|
I didnt get what exactly you want to do.
Mathod TextBox1_TextChanged(....) event handler only starts executing if those condition is satisfied.
Just a suggestion. You can put your code( whatever you are writing inside TextBox1_TextChanged(....) ) just after populating the textbox values from database.
Arindam,
|
|
|
|
|
hi,
no,I wrote dropdownlist select event to get service id and fetch from database max of corresponing serial no. which i populate in textbox. now based on textbox text. i concatenate both field to create one inquiry id and checkfor it existance. for tha same i wrote code in textbox change event. but it does not fire as i fetching value from database.Now i am checking inquiry existance code on button. Is there any alternate so that user do not need to click button.
regards
imran khan
|
|
|
|
|
Hai Take One CompareField Validator and go to propeties
1.Type= integer
2.Operator= DataTypeChecking.
Happy Coding
Siddu
Software Developer
|
|
|
|
|
HI Imran,
That is not the case and you can use any number of controls that have the AutoPostBack property "true".Could you explain me the exact scenario what you want to ask?
Vicky
|
|
|
|
|
Hello, everyone,
As most of you know, Microsoft will release final AJAX version on January 2007.
I'd like to know if it's possible to include AJAX capabilities in an RDL (SQL Server Reporting Services 2005) file? We'd just need to add an UpdatePanel, right?
Or do we have to wait for a Service Pack...
Thanks,
Raphaël Désalbres
MCP - MCAD - MCSD .NET
|
|
|
|
|
Is this possible in ASP.NET in Visual Studio 2005.
I want to create a web site that contains about 4 pages. The data for each page is stored on a SQL Server 2005 database. The ConnectionString is always the same, but the SelectCommand will differ depending on that page's function. Can't I place these instructions into a global module on the web site and have them called when needed?
If this is possible, how do I create a VB module on the web site?
Thank you,
Quecumber256
|
|
|
|
|
Hey Quecumber256,
VB modules are not recommended in .NET world. But you can still create a module of your own. Just click Add New Item and add a class file. Then clear the file and add
Public Module MODULENAME
End MODULENAME
Don't try to change the extension. The file extension should be .vb only.
Another solution:
If you are going to store only the ConnectionString info then use Web.Config file which is recommended by .NET. If you want to remember any objects try Sessions.
Have a nice day man...
Regards,
Venkatesh Mookkan.
Software Engineer
|
|
|
|
|
You can place the connection string (and others) in the web.config
|
|
|
|
|
Hi ,
Store the ConnectionString in web.Config's AppSetting .Add a new class(note this is not amodule) and write your functions to retrieve the data from database .IN code behind page , call the methods from the class to display the records into page.
Vicky
|
|
|
|
|
Sir
Please consider my error when it becomes while I click an button.so please tell what are the solutions to claer it..The following errors are:
---------------------
Line 839:sub page_load(s as object,e as eventargs)
Line 840:con=new oledbconnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("db1.mdb") & ";")
Line 841:con.open()
Line 842:cmd=new oledbcommand("select * from Table1",con)
Line 843:dr=cmd.executereader()
Source File: c:\inetpub\wwwroot\project\account1.aspx Line: 841
Stack Trace:
[OleDbException (0x80004005): Could not use ''; file already in use.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
System.Data.OleDb.OleDbConnection.InitializeProvider()
System.Data.OleDb.OleDbConnection.Open()
ASP.account1_aspx.page_load(Object s, EventArgs e) in c:\inetpub\wwwroot\project\account1.aspx:841
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
sargunam
|
|
|
|
|
You forgot to close the connection that has been opend already.
Whenever to use reader object it must be closed using connection object's close() method.
So what you need to do ... add the line " con.close() " and execute it.
Hope you can solve it now.
Arindam
|
|
|
|
|
Sir,
Thank u for ur reply...but it makes an error when
I already gave correctly con.close() method.but the db1.mdb has same name which stored in another path..
Is there way to come an error...please review my error
|
|
|
|
|
There is another way which produce this error. If you have been kept your mdb file open. (ie) You have been opened the db1.mdb in Access or equivalent application. Close that application before you open the connection.
Regards,
Venkatesh Mookkan.
Software Engineer
|
|
|
|
|
Thank u for ur reply...but it makes an error when
I already gave correctly con.close() method.but the db1.mdb has same name which stored in another path..
Is there way to come an error...please review my error
|
|
|
|
|
Could you debug and tell me what are you getting in,
Server.Mappath("db1.mdb")
Check the path with your location....
Regards,
Venkatesh Mookkan.
Software Engineer
|
|
|
|
|
Sir,
In my project contains two Forms.Form 1(namely Login page) and Form 2(namely account page).Form2 contains two buttons, we click an 1st button another page will open if button1 as set as start page.probably it would work directly click an form 2.But if we enter through an form1 to form2 then click button1 it forms an error like ..
File Already open in open()
so what can i do
|
|
|
|
|
I think this might help... Check your permission level of that directory...
Cause
This error usually happens on Windows NT, Windows 2000 or Windows XP and may be caused by any of the following conditions:
- the database file or database folder doesn’t have necessary security permissions to write to, or erase an .ldb file created by Microsoft Access when opening the database
- the database file doesn't have sufficient security permissions or write permissions to be modified when updating data in it. The web browser is seen by the web server as a Internet User that has the server account IUSR. This user needs to have write permission to the database file and to the database folder.
Resolution
Follow these steps to resolve this issue:
1. Use Windows Explorer to find the folder on the disk, which contains the database file (.mdb). This is usually your project folder.
2. Right-click on the project folder and select Properties.
3. Uncheck the Read-only property.
4. Click on the Security tab in the properties window.
(Attention: If you don't see such tab (Windows XP), close the properties window, open any folder, select Tools -> Folder Options -> View, and uncheck the option Use simple file sharing.)
5. Click Add and find, then select the user IUSR_<COMPUTERNAME>.
6. Select the Write checkbox in the Allow; column to assign Write permissions to the IUSR account.
More Info
After being fixed, this error may reoccur when compacting the MS Access file since the database file being compacted is being erased and a new one is created in its place.
Source:
Click here[^]
-- modified at 1:37 Friday 29th December, 2006
Regards,
Venkatesh Mookkan.
Software Engineer, India
|
|
|
|
|
One advise if you dont mind, whenever you are opening a connection check whether its closed or opened. like as follows
if con.state=connectionstate.close
con.open();
Remember always follow this and follow the above also.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Can I delete all the elements at once from a .net server drop down list control by using Javascript function.
Or atleast show me how can I find the count of items in a .net server side drop down list box by using Javascript function. So that I can use <ddlname>.remove(<index>).
But show me atleast any one thing, please.
Thank you very much.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Hey man use,
document.getElementById('CONTROLNAME').length=0;
This will remove all the elements from the DropDownList box. This code works fine in IE and Mozilla's latest version.
Regards,
Venkatesh Mookkan.
Software Engineer
|
|
|
|
|
Yes its working nice. Thanks dear.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|