Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Saturday, March 31, 2012

Text box reading old value

Hi i am trying to create a simple page that would allow users to edit there infromation that is stored on them,

It loads the information from the database fine and puts it into the textbox's but then on the "update" button it doesnt get the changed values

e.g

if the textbox was set on the page load to "bren" and then i changed it on the page to be "Hello" when i execute the onlclick function of the button it still reads as "bren"

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.Odbc;public partialclass user_userDetails : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) {if (!HttpContext.Current.User.Identity.Name.Contains(ConfigurationManager.AppSettings["siteGSTPrefix"])) {string userGuid = HttpContext.Current.User.Identity.Name; OdbcConnection detailsCon = sqlconnect.Connect(); OdbcCommand detailsCom =new OdbcCommand("SELECT tbl_usr.Username,tbl_usr_info.first_name,tbl_usr_info.second_name,tbl_usr_info.address_line_1,tbl_usr_info.address_line_2,tbl_usr_info.address_line_3,tbl_usr_info.post_code,tbl_usr_info.home_phone,tbl_usr_info.work_phone,tbl_usr_info.email_addy FROM tbl_usr INNER JOIN tbl_usr_info ON tbl_usr.usr_guid = tbl_usr_info.usr_guid WHERE tbl_usr.usr_guid='" + userGuid +"'", detailsCon); OdbcDataReader detRead = detailsCom.ExecuteReader();while (detRead.Read()) { userNote.Text ="Your Password is not displayed for security!"; userName.Text = detRead["Username"].ToString().Replace("#@dotnet.itags.org.","'"); fName.Text = detRead["first_name"].ToString().Replace("#@dotnet.itags.org.","'"); sName.Text = detRead["second_name"].ToString().Replace("#@dotnet.itags.org.","'"); aD1.Text = detRead["address_line_1"].ToString().Replace("#@dotnet.itags.org.","'"); aD2.Text = detRead["address_line_2"].ToString().Replace("#@dotnet.itags.org.","'"); aD3.Text = detRead["address_line_3"].ToString().Replace("#@dotnet.itags.org.","'"); pCode.Text = detRead["post_code"].ToString().Replace("#@dotnet.itags.org.","'"); hPhone.Text = detRead["home_phone"].ToString().Replace("#@dotnet.itags.org.","'"); wPhone.Text = detRead["work_phone"].ToString().Replace("#@dotnet.itags.org.","'"); eAddy.Text = detRead["email_addy"].ToString().Replace("#@dotnet.itags.org.","'"); } detRead.Close(); detailsCon.Close(); }else { Response.Redirect(FormsAuthentication.LoginUrl); } }protected void update_click(object sender, EventArgs e) {string userGuid = HttpContext.Current.User.Identity.Name;string passSettings =string.Empty; Response.Clear();if(userPass.Text.ToString() !="" && userPass.Text.ToString() !=null) { passSettings =" , tbl_usr.Password = '" + userPass.Text.ToString().Replace("'","#@dotnet.itags.org.") +"'"; } OdbcConnection detCon = sqlconnect.Connect(); OdbcCommand upCom =new OdbcCommand("UPDATE tbl_usr SET tbl_usr.Username = '" + userName.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' " + passSettings +" WHERE tbl_usr.usr_guid = '" + userGuid +"'", detCon); upCom.ExecuteNonQuery(); OdbcCommand upComInfo =new OdbcCommand("UPDATE tbl_usr_info SET tbl_usr_info.first_name = '" + fName.Text.Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.second_name = '" + sName.Text.Replace("'","#@dotnet.itags.org.").Trim() +"' , tbl_usr_info.address_line_1 = '" + aD1.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.address_line_2 = '" + aD2.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.address_line_3 = '" + aD3.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.post_code = '" + pCode.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.work_phone = '" + wPhone.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.home_phone = '" + hPhone.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.email_addy = '" + eAddy.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' WHERE tbl_usr_info.usr_guid = '" + userGuid +"'", detCon); upComInfo.ExecuteNonQuery(); userNote.Text ="Your details have been updated"; }}


Thanks for your help in advance

Dan

your update_click is happening after the page_load. try changing the code you have in page_load to page_prerender and see if you are good to go.


i have treid to user it with IsPostBack but it doesnt work,

i didnt think that Page_load was re run when u clicked on a button and ran the function

Dan


Fixed it now thanks changed it to a !IsPostBack and it now works thanks

Wednesday, March 28, 2012

Text boxes in web pages

Am I the only person in the world or are there others that experience this problem.

When programming a web page, I create a table with text boxes in it. The background color of the boxes change to a yellow colr when the app is run.

I have even tried resetting the color in code but it still changes to yellow.

This has happened in several versions of VB .net that I have used.

Any solutions would be greatly appretiated as I have tried all that I know.

PeterGThread Moved
It's not ASP.NET - it's the Google toolbar, or any other autocomplete toolbar, you have installed.
Yes, that is true. I just learned of this in another thread a few hours ago thanks to timeshifter.

Uninstall the google toolbar.

text boxes appearing differently

I am trying to create a simple user control for a person's name, It will ask for first name, middle name, last name, and suffix.
For some reason the text box associated with suffix is appearing with a background of while while all the others have a background of yellow. The properties are all the same for each of the boxes.
I have determined this is due to my google bar. Any idea what I can do to ensure consistency without removing the google bar?
<code>
<html>


First Name:You must enter a first name for the provider
Middle Name:
Last Name:You must enter a last name for the provider
Suffix: (e.g. Jr. , M.D. , etc.)

</html>
</code>

Yep, here ya go:
http://code.jenseng.com/google/

text content interface/component/control?

i wish to create a interface for my client to enter their news/announcement.
I've seen forums that has very nice interface that allow you click on
buttons such as "Bold", "Italic", "Underline", "URL", etc. How do i create
such interface? Or is there such a component? Within dreamweaver? How should
i go about developing such a interface? Thanks.Michael wrote:

> i wish to create a interface for my client to enter their news/announcement.
> I've seen forums that has very nice interface that allow you click on
> buttons such as "Bold", "Italic", "Underline", "URL", etc. How do i create
> such interface? Or is there such a component? Within dreamweaver? How should
> i go about developing such a interface? Thanks.

Take a look and see if http://www.freetextbox.com/ has what you need.

Daniel

Text Countdown

I want create a text countdown control that counts text down as its typed in a textbox or textarea

how do i go about doing this using c#

Not sure C# is really the way to go with this, Javascript is probably a better choice.

Here's an example I found by Googling:

http://www.smartwebby.com/DHTML/textbox_characters_counter.asp


C# example

http://www.rosshawkins.net/rfh/articles/asp.net-text-counter.html


That's a combination of c# and JavaScript - rather than one or t'other

Smile

Text editor

I want to create a simple text editor for my site so that administrators can update website content without having to know html. So for example in the text box they hit the enter key and it automatically inserts the <p></p> tags, and of course more advanced functions.

Does anyone know a good tutorial or something that tells me how i can achieve this?

thanks.www.richtextbox.com
Hello,

maybe a "HTML viewing and editing" component which is developed by the "WebMatrix"-Team is very helpful for you. Even if this component is developed as a WinForms-Application in C# you can see the complete source for developing a text editor where you can input and format a free text and then convert it to HTML-source.

You can download the component here:HTML viewing and editing component

HTH,

Monday, March 26, 2012

text file format

I need to create a text file which I can get working but i need it to be in
this format which I'm close but not exactly there yet.
format I need:
1234569 BMW
1253252Mercedes
9876522 Lexus
9858252 Jaguar
I'm getting this format:
1234569 BMW
1253252 Mercedes
9876522 Lexus
9858252 Jaguar
here is my code I'm using to write the lines in the text file
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
file.WriteFile(CarSales);
am I missing something?I got it working I removed the (-) sign.
instead of this:
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
i did this:
string CarSales = string.Format("{0,9}{1,8}", VINNumber, CarMake);
and now the file lines up correctly
"igotyourdotnet" wrote:

> I need to create a text file which I can get working but i need it to be i
n
> this format which I'm close but not exactly there yet.
> format I need:
> 1234569 BMW
> 1253252Mercedes
> 9876522 Lexus
> 9858252 Jaguar
> I'm getting this format:
> 1234569 BMW
> 1253252 Mercedes
> 9876522 Lexus
> 9858252 Jaguar
> here is my code I'm using to write the lines in the text file
> string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
> file.WriteFile(CarSales);
> am I missing something?
>
>

text file format

I need to create a text file which I can get working but i need it to be in
this format which I'm close but not exactly there yet.

format I need:
1234569 BMW
1253252Mercedes
9876522 Lexus
9858252 Jaguar

I'm getting this format:
1234569 BMW
1253252 Mercedes
9876522 Lexus
9858252 Jaguar

here is my code I'm using to write the lines in the text file
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
file.WriteFile(CarSales);

am I missing something?I got it working I removed the (-) sign.

instead of this:
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
i did this:
string CarSales = string.Format("{0,9}{1,8}", VINNumber, CarMake);
and now the file lines up correctly

"igotyourdotnet" wrote:

Quote:

Originally Posted by

I need to create a text file which I can get working but i need it to be in
this format which I'm close but not exactly there yet.
>
format I need:
1234569 BMW
1253252Mercedes
9876522 Lexus
9858252 Jaguar
>
I'm getting this format:
1234569 BMW
1253252 Mercedes
9876522 Lexus
9858252 Jaguar
>
here is my code I'm using to write the lines in the text file
string CarSales = string.Format("{0,-9}{1,-8}", VINNumber, CarMake);
file.WriteFile(CarSales);
>
am I missing something?
>
>
>
>

Thursday, March 22, 2012

Textarea retrieve data

Hi, i trying to use the textarea to retrieve some text data from the data access, but i can't meke it. anyone know how to create it ??
regards
wendyHello,
1) The textarea should be declared to run at server
2) Fill the textarea after that
Tell me if you need some helpful code
regards

Tuesday, March 13, 2012

TextBox - Database

Hi All

I have got a registration form..where new Users create the new user IDs...

I just want to check whether the username exists in the database as soon as the user leaves the textbox .

Please help.

Thanks

Asif Ali.

Are you using ASP.NET 2.0 Membership?

Or are you doing things yourself in a SQL table?


HI there

I m doing thing son my own on access database.

Thanks

Asif Ali.


TextBox - Database

Hi Kaushal

U havent seen my question properly.

And also in future please abstain from answering my Q's.

Thanks

Asif.


acube82:

Hi Kaushal

U havent seen my question properly.

And also in future please abstain from answering my Q's.

Thanks

Asif.

oh... i am so so so so so sorrryyy... if you have read the sample code which i have posted before... that was written in btnLogin_Click event... (but we should have that much knowledge that we can write this code event in textbox_chanage event with autopostback tru for textbox)... the code was about select query run against database which would return the datareader if there would be any user in the database with the same name (by checking reader.hasrows) other wise ... it will go to goto label "invaliduserpass" (we should have that much common knowledge that we can change it to msg like "user name already exists..".. anyway... your quote posted will be taken care of in future... thanx..


Ahh, did you get an answer to your question?

Basically (as I think was stated above)... you'd just want to run a SQL query against you're table to see if the username already exists... if you need help with that let me know :)


Since, you want that if the user exists or not as soon as the user leaves the textbox you can make use of AJaX calls. If you are using ASP.NET 2.0 then you can use client callbacks. Using AJAX your page won't refresh and you will know whether the user exists or not. Let me know if you need further details.


Hi...Azam...

I m a beginner..So not into AJAX at the moment.

If U can help me out, will be highly appreciated.

Thanks

Asif Ali.