use the
if(!Page.IsPostback)
{
}
Your first problem is the fact that you write barely understandable questions... structure your questions correctly and learn proper English.
by the looks of things, you are either a web developer that is trying to code software or you are a web developer that used to use php and has no real clue as to what JavaScript Is.....
If you are using windows forms (SOFTWARE , NOT WEB) then you will find the answers in your events tab (next to properties).
if you are using ASP , C# and javascript, there are multiple ways of doing this, however i think the most time effective at this time would be to use attributes...
in your form load event type something like this:
pictureboxId.Attributes.Add("onMouseOver", "JS EVENT HERE");
// the above will act as a mouse over event.
// Now lets do the mouse out event
pictureboxId.Attributes.Add("onMouseOut", "JS Event Here");
Play with it a bit .... and see where the road takes you
Hi there,
I am trying to write a stored procedure that will basically loop through the database, get allthe tables in the database and then for each table in the database it will take an entry of that database and just insert it into that same table again... i am really getting it , the oly problem comes with how to do the insert really ...
Here is my code
ALTER Procedure [dbo].[e_Duplicate]
(
@id_Old INT,
@id_New INT
)
As
-- =============================================
-- Author: xxxxxx
-- Create date: xxxxxx
-- Description: xxxxxx
-- =============================================
BEGIN
-- Create a table to store all table names that are used
DECLARE @Table_For_Tables AS TABLE
( PK INT IDENTITY(1,1) NOT NULL, Table_Names VARCHAR(500) )
-- Insert into that table
INSERT INTO @Table_For_Tables
( Table_Names )
SELECT DISTINCT Table_Name
FROM dbo.Items -- This table has a list of all tables
WHERE Table_Name != ''
ORDER BY Table_Name
-- Create a cursor to loop through the tables and update them
DECLARE @tableID INT -- For use with sorting in the loop
DECLARE myCursor CURSOR FORWARD_ONLY FOR SELECT PK
FROM @Table_For_Tables ORDER BY PK ASC;
OPEN myCursor
FETCH NEXT from myCursor INTO @tableID
WHILE (@@fetch_status = 0)
BEGIN
DECLARE @myTableName VARCHAR(500)
SET @myTableName = (SELECT TOP(1) Table_Names FROM @Table_For_Tables WHERE PK = @tableID)
INSERT INTO @myTableName -- THIS IS WHERE I CANT FIGURE OUT THE NEXT MOVE
SELECT TOP(1) * FROM @myTableName WHERE Esid = @Esid_Old
UPDATE @myTableName SET TOP(1) Esid = @Esid_New
FETCH …
I get the following message when executing a stored procedure.
The query has exceeded the maximum number of result sets that can be displayed in the results grid. Only the first 100 result sets are displayed in the grid.
However , i cannot change the fact that the SP uses a cursor.
Basically what happens is that the SP executes into a declared table, and then for each row it executes a new stored procedure bringing the number of result sets to about 20 000....
Any advice on where i can change this setting ?
Regards,
HI there.
We are currently creating a page which contains
(a) 10 Check Boxes
(b) for each check box there is a radio button list with 10 values.
What we want to achieve is the following
When e.g. The first checkbox is checked, the forst radio button list should be made enabled with script - this has been achieved.
However, lets say they check the first 3 check boxes, the first 3 radio buttton lists should then be made enabled, which works fine, but now i want to limit the users raning to 3 instead of 10, and also not to allow the user to rate a rating of say 1 twice, meaning that the user must rate in numerical order say 1 , 3 , 2 - not 1, 1 , 2 or 3, 3 ,2 ...
How could i do this in JavaScript ?
regards,
Hi
I use Visual 08 ASP.NET C# and JavaScript
I would like to do the following validation on a text box
the length MUST be 12 characters long in the following format
LLLLLLNNNNNN
Where
L = Letters
N = Numbers
if the users input does not match the required format i want the textbox's backcolor to go red , but if the users input matches the required format i want the textbox's text to go green.
I have absolutely no idea how to do this in Javascript so any help would be appreciated.
Thanks in advance.
Regards.
HI my friend...
assuming that you have 365 pages already made, you could do the following
- THIS IS A QUICK FIX
What you need is a table in your database with 3 columns
1. PrimaryKey INT, NOT NULL
2. Date DATETIME
3. NavigateURL VARCHAR(MAX)
In your database you will have a page per day linked to the date.
You can use this script
CREATE PROCEDURE TEMP_Procedure
AS
BEGIN
DECLARE @Start INT
DECLARE @END INT
SET @Start = 0
SET @End = 356
Secondly you need to add the dates
DECLARE @StartDate DATETIME
SET @StartDate = (The date you want to start on)
WHILE @Start <= @End
BEGIN
INSERT INTO dbo.YourTableName
(
PrimaryKey
, Date
)
VALUES
(
@Start
, @StartDate
)
@Start = @Start + 1
@StartDate = DATEADD(@StartDate , DAY, 1) -- Play with the sequence as i am a bit unsure of the sequence
END
This will give you the Identities per page
as well as the dates
...
now all you need to do is specify the page.
--------------------------------------------------------
No in your code you can fill a dataset with the URL
Your query will look like this
string.Format("SELECT NavigateURL FROM Table WHERE Date = '{0}'", DATETIME.NOW.DATE);
and then you will redirect
Response.Redirect(DataSetName.Tables[0].Rows[0][0/*this is the column*/].ToString());
There you go mate , have a good one...
well it just bounces ...
No error...
however the backup file is 0 bytes
Hi my friend , i have that .
/// <summary>
/// Backups are done here
/// </summary>
#region Backup Methods
#region Full Backup method
void Fullbackup()
{
method = "Full";
// Creating connection
Username = txtUsername.Text;
Password = txtPassword.Text;
// specifying connection string
DBhandler.DbWinHandler dbHandler = new DBhandler.DbWinHandler("Data Source=" + txtServerName.Text + ";Initial Catalog=master;Persist Security Info=True;User ID=" + Username + ";Password=" + Password);
// Getting the items that has to be backed up
foreach (string lstItem in listBoxControl2.Items)
{
dbName = lstItem;
if (!Directory.Exists(textEdit1.Text + "/DataSafe Backups/Temp/"))
{
DirectoryInfo newDir = new DirectoryInfo(textEdit1.Text + "/DataSafe Backups/Temp/");
newDir.Create();
}
lblStatus.Text = "Backing up " + dbName;
lblStatus.Refresh();
dbHandler.SmartGetDataSet("BACKUP DATABASE " + dbName + " TO DISK = '" + textEdit1.Text + "/DataSafe Backups/Temp/" + dbName + ".bak' WITH NAME = '" + dbName + ".bak'");
ZipFile();
}
}
#endregion
#region Differential Backup method
void Diffbackup()
{
method = "Diff";
// Creating connection
Username = txtUsername.Text;
Password = txtPassword.Text;
// specifying connection string
DBhandler.DbWinHandler dbHandler = new DBhandler.DbWinHandler("Data Source=" + txtServerName.Text + ";Initial Catalog=master;Persist Security Info=True;User ID=" + Username + ";Password=" + Password);
// Getting the items that has to be backed up
foreach (string lstItem in listBoxControl2.Items)
{
dbName = lstItem;
if (!Directory.Exists(textEdit1.Text + "/DataSafe Backups/Temp/"))
{
DirectoryInfo newDir = new DirectoryInfo(textEdit1.Text + "/DataSafe Backups/Temp/");
newDir.Create();
}
lblStatus.Text = "Backing up " + dbName;
lblStatus.Refresh();
dbHandler.SmartGetDataSet("BACKUP DATABASE " + dbName + " TO DISK = '" + textEdit1.Text + "/DataSafe Backups/Temp/" + dbName + "_Differential.bak' WITH DIFFERENTIAL, NAME = '" …
:'( Hello everyone,
i wrote an application that makes database backups and zips them.
Can anyone please tell me what i need to do in order to get the apllication to work on IIS 6 windows server 2003 SQL 05
1. The application works fine on machines for both XP and VISTA.
2. The application runs fine on Win Server 2003 however :
my problem is : obviously the database is in use by the web site.
How can i give my application permission to make the backup while the website is connected to the database ?
regards,
#
// create a writer and open the file
#
TextWriter tw = new StreamWriter("date.txt");
How do you want to convert a textwriter to a streamwriter like this ??
Maybe thats your problem dude
Please use <Iframe>
Your farme should be encapsulated within a <div> with relative positioning - 'Style="position:relative"
- position your Div within a table cell and it should be fine
have a good day
'hey sknake,can u tell me one thing,that instead of writing Button1.Attributes.Add("onclick", "javascript:alert('hello');"); on button click event,Y we write it in Page Load event! '
This is used in the form load so that the Javascript is applied to the control once the form loads, otherwise this will only be applied to the control once you click on a button , therefore you will have to click the button twice.
1. to apply the JavaScript
2. to fire the javaScript
Hi there.
please position your page with % instead of px, pt, em or any other measurement.
if you use percentage the page will adapt to the sizr of the window.
regards,
If you have the path + name of the file . maybe try the following.
add the path and name to a datatable.
From there you need to get the selected index of the grid row.
Then you get the datarow and the clumns of the row [file path] [file name] and assign it to the item you need ... then on click , response.redirect .
You need to download the newer version of the AJAX toolkit man...
Hi,
i have encountered similar problems in the past as well, please tell me wether you are using this variable within your JS or ASP CS code.
i would like to share with you one handy dandy control - the Hidden Field.
You could change the hidden field value with JavaScript like this:
#region Change Variable
string changevalue = string.Format("javascript:document.getElementById('{0}').value = {1}.options[{1}.selectedIndex].value;", hiddenfield1.ClientID, dropdownlist1.ClientID);
dropdownlist1.Attributes.Add("onChange", changevalue);
#endregion
You can place that code within your formload - PS this cannot be within the
if(!Page.isPostback)
{}
else you will get errors later.
-----------
now what you want is that variable
INT myVariable = int.parse(hiddenfield1.value.Tostring());
Boom.
This variable myVariable should be global, and thus the value can change constantly over multiple events.
if you require this variable to be used cross postback, add it to a session :
session["MyVariable"] = myVariable.Tostring();
or in the querystring :
response.redirect(string.Format("Mypage?variable={0}", myVariable));
Hope this helps.
Regards,
Hi ,
I need to create a page that has databound controls . eg.
Say i have a row with the following columns
1. TrackKey VARCHAR(50)
2. State VARCHAR(50)
3. Reason VARCHAR(50)
4. DateChanged DATETIME
------------------------------------------------------------
Now for each row in the table, the controls should be like this
1. TrackKey - Label
2. State - dropdownlist
3. Reason textbox
4. DateChanged - 3 dropdownlists [years, months , days]
---------------------------------------------------------------
I am able to dynamically load these controls, but due to postback i cannot save the information that changed.
can anyone give me some advice on how to change this ?
here is my code for loading:
void GenerateList()
{
// This method will generate a table for editing states
// Dataset for storing values
DataSet setGetTrackings = new DataSet();
// In the grid - the controls
Label TrackKey = new Label();
DropDownList SetState = new DropDownList();
TextBox reason = new TextBox();
DropDownList Days = new DropDownList();
DropDownList Months = new DropDownList();
DropDownList Years = new DropDownList();
HtmlTableCell htmlCell = null;
HtmlTableRow htmlRow = null;
HandleStates entry = new HandleStates();
// finally we will count the rows for inserting
int rowcount = 2;
int IndexCount = 0;
//Set the tables.
if (setGetTrackings != null && setGetTrackings.Tables.Count > 0)
{
foreach (DataRow row in setGetTrackings.Tables[0].Rows)
{
// Create the controls.
TrackKey = new Label();
SetState = new DropDownList();
htmlCell = null;
htmlRow = null;
reason …
Ah never mind , i cleared the solution and restarted my PC, seems like some sort of .dll issue ?
Hi
I am writing a web application with VS 2008 standard edition.
I just got this really weird error.
I replaced a few of the controls on the form from labels to text boxes,
and it worked fine , but all of a sudden it shows me the old controls again, however in my designer everything seems to be fine.
Any help on this ?
Thanks
Ah thanks guys its definately the label , it doenst have postback value ... i forgot :)
Thanks so much ....
Hi
I have a form with
1. dropdown (ddTTDBenefitP1)
2. label (lblBenefitPeriodFactor1)
The combobox is populated with listitems
[Text & value]
I applied attributes to this dropdown.
// ddTTDBenefitP1
ddTTDBenefitP1.SelectedIndex = 0;
string ddTTDBenefitP1_script = string.Format("javascript:document.getElementById('{0}').innerText = {1}.options[{1}.selectedIndex].value;", lblBenefitPeriodFactor1.ClientID, ddTTDBenefitP1.ClientID);
ddTTDBenefitP1.Attributes.Add("onChange", ddTTDBenefitP1_script);
So when a user changes the selectedItem , the label display's the value of the selected Item.
However, when i save, i need to grab the value of the label.
But for some reason its 0 or blank ... But the actual text is not
Can anyone help ?
Hi everyone,
I would like to set a label's text when a dropdownlist item is selected
I want the label to display the value of the item, not the text.
Is there any way i can do so without refreshing the page i found the update panel loads far too long for my liking.
Javascript ???
i would like to do this using attributes
ddBenefitPeriod.Attributes.Add("selectedIndexChanged", string.Format("{0}.innertext = {1}.options[{1}.selectedIndex].value; ", lblBenefitPeriodFactor.ClientID, ddBenefitPeriod.ClientID));
This does not work, can anyone give me some pointers please ??
Thanks in advance
:)
Oh yes and this is where i get the error ...
#
//Redirect.
#
base.Response.Redirect(String.Format("FulfillmentPayment.aspx?Command=Edit&InvoiceId={0}",
#
result.Tables[0].Rows[0][0]));
With error
Object reference not set to an instance of an object.
Hi There
I get the following error when clicking on btn
This code works perfectly on some machines but does not work on others
protected void btnSave_Click(object sender, EventArgs e)
{
if (btnSave.Text.ToUpper() == "CREATE")
this.InsertInvoice();
else if (btnSave.Text.ToUpper() == "SAVE CHANGES")
this.UpdateInvoice();
}
private void InsertInvoice()
{
String sqlCommand = String.Empty;
DataSet result = null;
//Create the command.
sqlCommand = String.Format("EXEC nga_InsertPaymentInvoice {0}, '{1}', {2}, '{3}', '{4}', '{5}'",
1, ddVendors.Text, "0.14", txtReasonForPayment.Text,
txtAuthoriser.Text, DateTime.Now.ToLongDateString());
//Execute the command and get the new invoice id.
result = m_dbHandler.SmartGetDataSet(sqlCommand);
//Redirect.
base.Response.Redirect(String.Format("FulfillmentPayment.aspx?Command=Edit&InvoiceId={0}",
result.Tables[0].Rows[0][0]));
}
Here is the stored procedure
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[nga_InsertPaymentInvoice] @invoiceType INT, @couplingEntity NVARCHAR(256), @taxRate FLOAT,
@reasonForPayment TEXT, @authoriser NVARCHAR(256), @dateCreated DATETIME
AS
BEGIN
INSERT INTO nga_PaymentInvoices VALUES (@invoiceType, @couplingEntity, @dateCreated, @taxRate, @reasonForPayment,
@authoriser);
SELECT InvoiceId FROM nga_PaymentInvoices
WHERE invoiceType=@invoiceType AND couplingEntity=@couplingEntity AND dateCreated=@dateCreated AND
AtTimeTaxRate=@taxRate AND Authoriser=@authoriser;
END
Does anyone know why i get this error ??? I am using SQL server 2005 developer edition, visual studio 2008 C#
Thanks in advance
How can i set a text box's text to this format '0,000,000.00' rather than '0000000.00' ???'
Thanks
what exactly is a 'Database Schema' ?? and how can i make one ??
Yo dude , you will have to give some clearer details...
Does the textbox not display the new value or does it not update the database ??
Hi there, i would like to find out what the hell is wrong here
/// <summary>
/// Get a single integer value
/// </summary>
/// <param name="sql">The sql query used to retreive a result set</param>
/// <returns>The value of the first column in the first row of the result set as an integer</returns>
public virtual int GetSimpleInteger( string sql )
{
SqlCommand comm = new SqlCommand( sql, GetConnectionObject() );
try
{
// Reset the error object
ClearError();
return (Int32)comm.ExecuteScalar(); <------- Error here
}
catch( SqlException ex )
{
SetError( ex );
return -1;
}
}
now the funny thing is this worked perfectly until today, i just switched my PC on and built the project straight, now also i cannot connect to SQL either...
I get this error ExecuteScalar requires an open and available Connection. The connection's current state is closed.
PLEASEEEEEEEEEEEEE HELP, this is very urgent, im on deadline
Thanks
Rashakil Fol gave the only thing else i could think of ...
But using "*.txt" will work fine ?
Ah cool, works like a charm ... thanks dudes
What do you mean 'automate ' it ?????
Yo dude, listen, just neglect the people who are rude, some of us actually want to help you , in fact, you can even add me if you want to, i will always try to help you ...
I think in order to become a good programmer, whether it be in C#, VB, Delphi or web development... the best place to start is Database programming - which is the core of 99% of any software available...
After that, look at FTP, Filestreams etc... The Web is the future, so creating programs that can be used on a desktop with File Transfer will be very handy ...
Other than that, i will also recommend Regularly visiting Microsoft Developers Forums
There you will find pretty much everything you need to know
And Lastly (THE MOST VALUABLE ADVICE) , just remember, we are all software developers, and even though there is a market big enough for all of us, we are all actually still rivals in competition, so if someone is rude, DON'T LET IT BOTHER YOU, get over it, you can make it...!!!!
Replace
this.Close();
With
Application.Exit();
The basic problem is that your XML file has either more or less columns than your Table, i would recommend writing the table on the button click...else add some null values ...
Speak to me RamyMahrous, what on earth do you mean ??? heheh ***nut bucket here
So either like save it to the new location directly in the Dest filestream or end the whole process then move it via new filestream ... ?????????
Hahaha, thanks man , i want to enable intellisense for my website...
no problem , just need to know where i can get the data...
So in other words you actually edit it then move it around and stuff ??
ok ... hmmmm, in that case, what happened ??? why didnt it work ???
Please tell me the error, i love them,
(the answer lies within) :P
Can anyone share with me the great mysterious wonder of where to locate the Outlook Addressbook on my C drive ???
Thank you in advance:)
Well maybe try copy the file to the desired location and then delete it at the original location, this is fairly simple so it wont be too much effort (i believe in using the least code for the best performance)
:yawn:
I am trying to import the address book from MS Office, can anyone tell me where to locate the MS Outlook addressbook ?
Thank you in advance... cVz
Just make sure you close the stream...
Else , like hieuuk said,
do the
Thread.sleep(1000) // 1 second
try this ??? is easy way to find
int I = 0;
foreach (string S in Text)
{
int I += 1;
}
Console.WriteLine(I.ToString());
What do you want to accomplish exactly
@ Salem
Why do you drag the man down ??? I take my hat off to someone who works hard in life to get somewhere , i had to work 3 jobs to just pay for my studies when i studied back in the day ...
Not cool man !!!!!!!!!!!!!
Create an application that does transactions via FTP , sort of something a chain of franchises would use as an OS so that everything in the server is always updated and always the correct data >>> Thats a cool plan yeah >???
Can anyone give me some good forums or advice on threadpools in C# ???
Thanks ...:D