|
still its not working...
any other suggestions....
thanks
|
|
|
|
|
why should'nt you tried it in c# ontextchanged event and still if you want your javascrit running are you sure you checked advance browser settings to enable javascript
(are you disabled them???? )
or maybe this onkeyup="texlenght()" need a ";" or onkeyup="textlenght();"
hope this should help.
|
|
|
|
|
Make sure onkeyup is a javascript event, and look at the HTML that's being generated to see if it looks the way you'd expect.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am inserting a new row in a database table (MSSQL).
I want to retrieve the value of Identity column associated with 'this' new row.
My stored procedure is as follows :
ALTER PROCEDURE dbo.Insert
(
@SubCategoryId tinyint,
@text nvarchar(MAX),
@Url nvarchar(2000)
)
AS
SET NOCOUNT ON;
INSERT INTO Table1
(SubCategoryId, text, Url)
VALUES (@SubCategoryId,@text,@Url)
SELECT NEWID = SCOPE_IDENTITY()
Now, I have a table-adapter in which i have any Insert function which uses the above stored procedure.
From the code-behind, i am inserting the data.
DataSetTableAdapters.Table1TableAdapter t1 = new DataSetTableAdapters.Table1TableAdapter();
int result = t1.Insert((byte)int.Parse(ddlSubCategory.SelectedValue), txtText.Text, txtUrl.Text);
The row is inserted in the database, but the returned value is not the Identity column ...
Is the stored procedure incorrect ?
I posted this in ASP.NET forum, because i want to do this in ASP.NET, i found the stored procedure on a database related site, still the stored-procedure is not working ...
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
It's still a SQL question.
Does 'I found the stored proc' mean you don't really understand what it does ? I suspect your core issue is probably that the table adapter 's insert method probably doesn't return the result of the proc, but a value such as the number of rows changed. Hard to say, you don't say what value you're getting back, but SCOPE_IDENTITY() will return that new id, so I don't see what the issue could be. The reason to use this is, it will return the id that your proc created, if you added SQL to find the highest id, and it was called by two users at once, you'd have a race condition.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: Does 'I found the stored proc' mean you don't really understand what it does ?
not 100% true.
Actually I am not good at writing the stored procedures.
Christian Graus wrote: the table adapter 's insert method probably doesn't return the result of the proc
this could be the issue ...
But my task is straight forward, I have to first Insert a row in one table, then using the value of the Identity column of the created row, some rows are to have inserted into other table where, the primary-key in this table is Foreign key in the other table.
What should be the approach to this problem ?
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
how to call function in class page to default.asp x
|
|
|
|
|
Umm, MethodName(//PossibleParameters)
I would highly suggest getting a book on ASP.NET, C#/VB.NET if you don't know how to even call a method.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
This guy is either a troll, or an absolute moron. I'd recommend ignoring his posts.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
OK, at this point I am certain that this is some sort of joke. Your questiosn get stupider and stupider, it's obvious that you can't be serious. The joke isn't funny, please stop it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
First of all i wud like to express my heartiest gratitude to the expertsof codeproject who have been helping me time to time so that i dont remain stuck with a particular problem.
My Prob:
I was using VS2005 for building my application but suddenly due to some unavoidable circumstances we are forced to migrate to VS2003.But I am not too well-versed with VS2003 andm finding it a bit difficult to convert my app into VS2003.
One such problem is that I was using string.contains in VS2005 but now I see that it doesnt exist in VS2003.So I wud like to know is there a way to implement the same feature in VS2003??plz help me out!!!!
|
|
|
|
|
First of all, this has nothing to do with visual studio. VS is just an editor. Documentation[^] for string.Contains says it is supported only on .NET framework 3.0 or later. In .NET 1.1, you have to use String.IndexOf[^] method to see whether a character exist or not.
|
|
|
|
|
I have a table in a database with certain fields which the user fills up through a form.At a later point,if the user wishes to see this form,I need to auto-fill those fields.The auto-fill works except for the DropDownList control.It always sets its field to the first item in the datalist.I tried 'DropDownList2.Items.FindByText(string).selected="True"' but it shows an error. I need the dropdownlist to show the text that was previously selected by the user and also giving the user an option to change his previous selection.
How do i do this?
|
|
|
|
|
DropDownList.Items.IndexOf(DropDownList.Items.FindByValue("InsertValueToFind"))
That is one of the ways I do it.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
|
Do you set the value of the DropDownList, or just the text?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Try the FindByText one.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
HI. got a project where you have a file menu, and you open a text file, then save the text file. and a exit menu item. now, if i click the open file menu item, it displays two text boxes, where you enter a name and phone number. but for some stupid reason, if i click the save menu item, i get a message saying the file needs to be open, and does not save the file? so what am i doing wrong and how to fix this? any help would be gretefully aprreciated. will post the code below. cheers Marvin.
'Program: Ch11 Open and Write File
'Programmer: Marvin Hunkin
'Date:Saturday March 7 2009
'Description: Allow the user to enter names and phone numbers and
' save them in a file.
Imports System.IO
Public Class frmCh11OpenAndWriteFile
' Declare module-level variable.
Dim PhoneStreamWriter As StreamWriter
Private Sub menSaveToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menSaveToolStripMenuItem.Click
' Save the record to the file.
If PhoneStreamWriter IsNot Nothing Then ' Is the file open?
With Me
PhoneStreamWriter.WriteLine(.tbNameTextBox.Text)
PhoneStreamWriter.WriteLine(.tbPhoneTextBox.Text)
With .tbNameTextBox
.Clear()
.Focus()
End With
With .tbPhoneTextBox
End With
End With
Else ' File is not open
MessageBox.Show("You must open the file before you can save a record", _
"File Not Open", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub menOpenToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menOpenToolStripMenuItem.Click
' Open the file.
Dim dlgResponseDialogResult As DialogResult
' Is the file already open?
If PhoneStreamWriter IsNot Nothing Then
PhoneStreamWriter.Close()
End If
' Begin in the project folder.
dlgOpenFileDialog.InitialDirectory = "C:\" ' Display the File Open dialog box.
' Make sure that the user didn’t click the Cancel button.
If dlgResponseDialogResult <> DialogResult.Cancel Then
' Open the output file.
End If
End Sub
Private Sub menExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menExitToolStripMenuItem.Click
' Close the file and the form.
If PhoneStreamWriter IsNot Nothing Then ' Is the file open?
PhoneStreamWriter.Close()
End If
Me.Close()
End Sub
End Class
|
|
|
|
|
In your code, when you want to open the file, you need something like this:
dim filePath as String = "" 'fully qualified path to the file
dim sw as New StreamWriter(filePath)
'write what you want to the file
sw.Close()
Try that, and if you still have problems post back, but I suggest you wrap your code snippets with the <pre></pre> tags.
|
|
|
|
|
Does it not feel strange to have posted a VB.NET question in an ASP.NET forum?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hI. SORRY ABOUT THAT. FORGOT I WAS IN THE ASP FORUM. SHOULD HAVE GONE TO THE VB FORUM. SORRY ABOUT THAT. HAD A SNEIOR MEOMENT AND FORGOT WAS IN THE WRONG FORUM. SO PLEASE FROGIVE ME FOR THAT MISTAKE. WAS TIRED AND FORGOT I HAD POSTED IN THE WRONG AREA. SO WILL NOT DO THAT AGAIN. CHEERS mARVIN.
|
|
|
|
|
Hi. welltried your suggestion, but think i got my self a bit confused and a bit muddled. so will paste the error below. got an exception error for line 96. can any one help. will paste the error as a graphic below and the code. so help me to get this working. what should i take out and keep in the code? cheers Marvin.
sender As Object, ByVal e As System.EventArgs) Han
'Program: Ch11 Open and Write File
'Programmer: Marvin Hunkin
'Date:Saturday March 7 2009
'Description: Allow the user to enter names and phone numbers and
' save them in a file.
Imports System.IO
Public Class frmCh11OpenAndWriteFile
' Declare module-level variable.
Dim PhoneStreamWriter As StreamWriter
Private Sub menSaveToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menSaveToolStripMenuItem.Click
' Save the record to the file.
If PhoneStreamWriter IsNot Nothing Then ' Is the file open?
With Me
PhoneStreamWriter.WriteLine(.tbNameTextBox.Text)
PhoneStreamWriter.WriteLine(.tbPhoneTextBox.Text)
With .tbNameTextBox
.Clear()
.Focus()
End With
With .tbPhoneTextBox
.clear()
.focus()
End With
.tbPhoneTextBox.clear()
End With
Else ' File is not open
MessageBox.Show("You must open the file before you can save a record", _
"File Not Open", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub menOpenToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menOpenToolStripMenuItem.Click
' Open the file.
dim strFilePath as String = "c:\Test.txt"
Dim dlgResponseDialogResult As DialogResult
' Is the file already open?
If PhoneStreamWriter IsNot Nothing Then
PhoneStreamWriter.Close()
End If
' Begin in the project folder.
dlgOpenFileDialog.InitialDirectory = "C:\" ' Display the File Open dialog box.
' Make sure that the user didn’t click the Cancel button.
If dlgResponseDialogResult <> DialogResult.Cancel Then
' Open the output file.
PhoneStreamWriter.WriteLine(tbNameTextBox.Text)
PhoneStreamWriter.WriteLine(tbPhoneTextBox.Text)
End If
End Sub
Private Sub menExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menExitToolStripMenuItem.Click
' Close the file and the form.
If PhoneStreamWriter IsNot Nothing Then ' Is the file open?
PhoneStreamWriter.Close()
End If
Me.Close()
End Sub
End Class
|
|
|
|
|
Aspx page return the following error
(Valid values are between 1 and 9666, inclusive.Parameter name: year )
when I am trying to Add calander from the tool box.
I am using the following culure in page tage:
UICulture="ar-sa" Culture="ar-SA"
I tried to use the following code in the load page:
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ar-SA");
System.Threading.Thread.CurrentThread.CurrentUICulture = ci; System.Threading.Thread.CurrentThread.CurrentCulture = ci;
but the same error returned
I adjust the Calander setting from control Panel to Higri calander and then
to grogrian calander but also the same error returne.
thanks in Advance
Mohammed Ibrahim
|
|
|
|
|
You shouldn't have this problem. Hijri year values are 600 years less than Gregorian.
Can you capture what value is going in? My guess is that nothing or null is being input and its getting casted into a 0 which would break the rule. You should set the default to DateTime.Now.Year.
If that's not the case, post back, but include the value being input and the snippet where its being handled.
|
|
|
|
|