|
you got it. But the problem is since the textbox is getting value and also textbox value is using for database in the same event, i think textbox value is not going to the database. But if i use the same thing in two events, its working fine. but i need that in a single event..
suchita
|
|
|
|
|
SayamiSuchi wrote: i think textbox value is not going to the database
For that, please share the event code! Once you get the value in ASPX, you should be able to save it.
|
|
|
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
{
WriteThisMessageToThePage1.sendMessageToThePage += delegate(string message){txtNeededDate.Text = message; };
WriteThisMessageToThePage2.sendMessageToThePage += delegate(string message){txtRequestDate.Text = message; };
cmd = new SqlCommand("INSERT INTO ProjectRequestInfo(ClientFName,ClientMName,ClientLName,Email,Extension,DepartmentName,ProjectTitle,ProjectDescription,DueDate,RequestDate,IntendedUsersAudience,SubmittedDate,NotificationTo) values('" + txtFirstName.Text + "','" + txtMiddleName.Text + "','" + txtLastName.Text + "','" + txtEmail.Text + "','" + txtExtension.Text + "','" + DrpDwnDepartmentList.SelectedItem.ToString() + "','" + txtProjectTitle.Text + "','" + txtProjectDescription.Text + "','" + txtNeededDate.Text + "','" + txtRequestDate.Text + "','" + txtIntendedUsers.Text + "','" + System.DateTime.Now.ToShortDateString() + "','" + getHighCnt + "')", conn);
conn.Open();
cmd.ExecuteNonQuery();
}
here i am getting value for txtNeededDate.text from message(i.e from usercontrol) and i am inserting the txtNeededDate.text to the database like that. It is not giving any error but it is not inserting value to database.
suchita
|
|
|
|
|
Could you just try putting a little delay after first two lines, before inserting in SQL?
like a dummy loop of 10,000 or so.
Or in debug mode, just put a breakpoint at cmd line and check what is the value of txtNeededDate.
|
|
|
|
|
Dummy loop is also not working...
suchita
|
|
|
|
|
From your code, there does not seem any problem.
One suggestion, yo could've public property in your usercontrol which gives the value that you want to update in textbox and use that property. This is cleaner and simple approach.
Debug your code and see where the problem lies.
Using the textbox to insert the data in DB should not be a problem. Also try using a local variable assign this first, then use this to insert in DB, might be you get the problem.
|
|
|
|
|
I tried using local variable too but the same problem...
suchita
|
|
|
|
|
Ya i tried with debug mode. textboxes are not getting values within that event. After that event, they are getting values.. So what can be done for such problems ??
suchita
|
|
|
|
|
Can anyone point me to some sample code in C# for converting an html table to image?
Praveen Kumar.R
|
|
|
|
|
|
I would like to create a horizontal menu based on a vertical menu that I click on home for example a vertical menu appears, if someone can give me advice or proposal
thank you
|
|
|
|
|
|
thank you for those links, but despite that, I could not do this action, display a vertical menu by clicking on a horizontal menu, please help me
|
|
|
|
|
Hi All,
I'm user VS 2005 and wanted to know if it's possible to create a user control that can be used in both a Windows Application and a WebSite?
I'm coding in C# with ASP.NET.
I'm wanting to create a control like the DateTimePicker, which is available when creating Windows Applications, but it doesn't seem to be available when creating WebSites. Please tell me if I'm wrong, this way I can build upon the existing control. Thanks.
If you know of any websites that might be useful, I would be very geratful if you shared them.
Thanks in advance.
Mel
|
|
|
|
|
MWRivera wrote: a user control that can be used in both a Windows Application and a WebSite?
Not possible, they are two separate environments.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
You are right but... he wanted to develop only 1 control for both Web & windows... which is not feasible as they both are totally different.
He only can develop something similar look wise and they way the works but they have to be two different controls!
|
|
|
|
|
Thanks for the replies guys. I guess I was hoping for a long shot.
Yes you're right Sandeep I was asking if I it was possible to create a single control taht could be used in both enviroments.
Does anyone know any alternative was of create a control that can be used within both enviroments. Or is there no avoiding two seperate controls?
Thanks,
Mel
|
|
|
|
|
Hi guys,
I am executing a stored procedure from my webservices, i would like this store procedure to check is a userid exist and if it does then i would like to return a value saying so.
Here is a quick proc...i don't know how to carry on from here.
USE [reportserver]
GO
--Create the Procedure
CREATE PROCEDURE FindCurrentUser(@userid VARCHAR(10), @RowCount VARCHAR(10) output)
AS
BEGIN
IF EXISTS(SELECT * FROM [UserProfile] WHERE [userid] = @userid)
BEGIN
RETURN @RowCount = 'Exists'
END
ELSE
BEGIN
RETURN @RowCount = 'NotExists'
END
END
but it gives me an error:
'Incorrect syntax near '='
Any help please??
Thanks,
Morg
|
|
|
|
|
Here's one way:
USE [reportserver]
GO
--Create the Procedure
CREATE PROCEDURE FindCurrentUser(@userid VARCHAR(10))
AS
BEGIN
declare @RowCount varchar(10)
IF EXISTS(SELECT * FROM [UserProfile] WHERE [userid] = @userid)
BEGIN
set @RowCount = 'Exists'
END
ELSE
BEGIN
set @RowCount = 'NotExists'
END
select @RowCount as Counter
END
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
Thanks man,
that was great help
|
|
|
|
|
I wouldn't use rowCount since it is a reserved word. Also I think you are making it more difficult on yourself by requiring hard coded strings. Hard coded strings for program control flow are bad. All you need is this:
select count([userid]) from [userprofile] where [userid]=@userID
Then in your C# you can just check for > 0.
|
|
|
|
|
Hi All ,
I want to run schedule task in every 1 min in background in asp.net but it should not interfere the other operation of application.
I tried with the following option
<a href="http://www.codeproject.com/KB/aspnet/ASPNETService.aspx"></a>
and it seems it is not working.can u guys provide me any solution or any sample.
Thanks and regards,
Amit Patel
|
|
|
|
|
Search about thread or timer and you will get something in google and start it in Application_Start method
|
|
|
|
|
Dont know why it was downvoted... direction is fine! gave a 5 to balance out..
|
|
|
|