Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 5th, 2004, 01:18 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Default i need emergency help about <asp:TextBox

hi every one i need help about asp:text box control
my problem i am using a form that some value from a db and dispaly it
and some one maybe like to change one or more of them but the problem raises when i am changing a text box that contains a value the value
finally dont affect and the former value was inserted to database or
dispaly .
what i must to do
Thanks In Advance.
YoOrD.

Beauty Is not on the face
Beauty is on the heart
--<<Ghibran Khalil>>--
__________________
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YoOrD .
Beauty is not on the face
Beauty is on the heart
~~&lt;&lt;Ghibran Khalil&gt;&gt;~~
 
Old October 5th, 2004, 01:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Not quite sure what your problem is... could you post any relevant code?

Thanks.
 
Old October 5th, 2004, 01:56 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Default

hi thaks for your reply
my problem is some thing like this the value i change to input doesnot affect and when i Write out a TextBox.Text it donot show new value that i change later but when a form is blank and without any
input(becuase i like to build a form that fetch some value from DB and display it in TextBox) but i like to change the former value of
some TextBox If Any users like to change his/her record how i can do this i can display the value in form but when i make change to record the value not affects and the former values is inserted to DB
ANY Idea. how i must to change .
Thanks In Advance.
YoOrD.

Beauty Is not on the face
Beauty is on the heart
--<<Ghibran Khalil>>--
 
Old October 5th, 2004, 02:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Well, for a textbox, TextBox.Text should work, but this issue may go beyond that. Could you post relevant code? That's the only way to get down the the issue.

Thanks,

Brian
 
Old October 5th, 2004, 02:45 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Default

The Code is this
Code:
 
Quote:
quote:<script language="c#" runat="server"> void Page_Load()             {              string strConnection;             strConnection=ConfigurationSettings.AppSettings["DSN"];              string strSql="select id,username,password,last,first from member_info";               strSql="select [id],[First],[Last],email,Father_Name,Date_Birth,Birt_num,Birt_Place,"+              "Mariage_Condition,Colg_cond,Job_Cond,Sabegeh_Khosos,Sabegeh_Dolati,Last_Activity,"+              "Year_OF_Gov,Year_OF_Priv,Address_Pos,Field,[from_d],Year_OF_Graduate,Technical_Profess,"+              "Title,Tel,Address_Job,Technical_Ict_Proj,Technical_Project_Personal, "+              "Membership_In_ICT_State,Technical_SuperViser_Project,Personal_Project,nation_ID,IT_Consultant, "+              "ICDL_Trainer ,Soldier_cond from member_info where username='mzz'";//+(string)Session["userstate"]+"';";              SqlConnection objSqlConn=new SqlConnection(strConnection);              SqlDataAdapter objSqlDA=new SqlDataAdapter(strSql,objSqlConn);              DataSet objDataSet=new DataSet();              objSqlDA.Fill(objDataSet,"member_info");              //objSqlDA.Fill(objDS,"member_info");              DataTable objDataTable=objDataSet.Tables["member_info"];              DataRow objRW=objDataTable.Rows[0];              first.Text=objDataTable.Rows[0]["first"].ToString();              last.Text=objDataTable.Rows[0]["last"].ToString();                 //email.Text=objDataTable.Rows[0]["email"].ToString();             Father_Name.Text=objDataTable.Rows[0]["Father_Name"].ToString();             Date_Birth.Text=objDataTable.Rows[0]["Date_Birth"].ToString();             Birt_num.Text=objDataTable.Rows[0]["Birt_num"].ToString();             Birt_Place.Text=objDataTable.Rows[0]["Birt_Place"].ToString();              dg.DataSource=objDataTable.DefaultView;              dg.DataBind();              SqlCommandBuilder objSqlcommandBuilder=new SqlCommandBuilder(objSqlDA);              //Response.Write("hello:"+Mariage_Condition.SelectedItem.Value);             }     void update(object sender,EventArgs e)              {              Response.Write("hello ii");            string strConnection=ConfigurationSettings.AppSettings["DSN"];                             //"Data Source=mzz;Initial Catalog=members;Integrated Security=SSPI;" ;             strConnection=ConfigurationSettings.AppSettings["DSN"];              string strSql="select [id],[First],[Last],Father_Name,Date_Birth,Birt_num,Birt_Place,Mariage_Condition,Colg_cond,Job_Cond,Sabegeh_Khosos,Sabegeh_Dolati,Last_Activity,Year_OF_Gov,Year_OF_Priv,Address_Pos,Field,Year_OF_Graduate,Technical_Profess,[To],[In] ,Title,Tel,Address_Job,Technical_Ict_Proj,Technical_Project_Personal, Membership_In_ICT_State,Technical_SuperViser_Project,Personal_Project,nation_ID,IT_Consultant, ICDL_Trainer ,Soldier_cond from member_info where username='mzz'";              SqlConnection objSqlConn=new SqlConnection(strConnection);              SqlDataAdapter objSqlDA=new SqlDataAdapter(strSql,objSqlConn);              DataSet objDataSet=new DataSet();              objSqlDA.Fill(objDataSet,"member_info");              //objSqlDA.Fill(objDS,"member_info");              DataTable objDataTable=objDataSet.Tables["member_info"];              dg.DataSource=objDataTable.DefaultView;              DataRow objRW=objDataTable.Rows[0];              objRW["first"]=first.Text;              Response.Write("first name:"+first.Text);              objRW["last"]=last.Text;              objRW["Father_Name"]=Father_Name.Text;              objRW["Date_Birth"]=Date_Birth.Text;              objRW["Birt_num"]=Birt_num.Text;              objRW["Birt_Place"]=Birt_Place.Text;              objRW["Colg_cond"]=Colg_cond.SelectedItem.Value;              objRW["Mariage_Condition"]=Mariage_Condition.SelectedItem.Value;              objRW["Job_Cond"]=Job_Cond.SelectedItem.Value;              objRW["Soldier_cond"]=Soldier_cond.SelectedItem.Value;              objRW["Sabegeh_Khosos"]=Sabegeh_Khosos.Text;              objRW["Sabegeh_Dolati"]=Sabegeh_Dolati.Text;              objRW["Address_Pos"]=Address_Pos.Text;              objRW["Field"]=Field.Text;              objRW["Year_OF_Graduate"]=Year_OF_Graduate.Text;              objRW["Technical_Profess"]=Technical_Profess.Text;              objRW["Address_Job"]=Address_Job.Text;              objRW["Title"]=Title.Text;              objRW["nation_ID"]=nation_ID.Text;             /////////////////////////////////////////              if(IT_Consultant.Checked==true)                 {                  objRW["IT_Consultant"]="Èáå";                 }                 else                   {                   objRW["IT_Consultant"]="뒄";                   }             /////////////////////////////////////////              if(Technical_Ict_Proj.Checked==true)                 {                  objRW["Technical_Ict_Proj"]="Èáå";                 }                 else                   {                   objRW["Technical_Ict_Proj"]="뒄";                   }             /////////////////////////////////////////               if(Technical_Project_Personal.Checked==true)                 {                  objRW["Technical_Project_Personal"]="Èáå";                 }                 else                   {                   objRW["Technical_Project_Personal"]="뒄";                   }             /////////////////////////////////////////           if(Membership_In_ICT_State.Checked==true)                 {                  objRW["Membership_In_ICT_State"]="Èáå";                 }                 else                   {                   objRW["Membership_In_ICT_State"]="뒄";                   }                   /////////////////////////////////////////           if(Technical_SuperViser_Project.Checked==true)                 {                  objRW["Technical_SuperViser_Project"]="Èáå";                 }                 else                   {                   objRW["Technical_SuperViser_Project"]="뒄";                   }          /////////////////////////////////////////           if(Personal_Project.Checked==true)                 {                  objRW["Personal_Project"]="Èáå";                 }                 else                   {                   objRW["Personal_Project"]="뒄";                   }  /////////////////////////////////////////           if(ICDL_Trainer.Checked==true)                 {                  objRW["ICDL_Trainer"]="Èáå";                 }                 else                   {                   objRW["ICDL_Trainer"]="뒄";                   }             // objRW["Technical_Ict_Proj"]=Technical_Ict_Proj.Item.Checked;              dg.DataBind();              SqlCommandBuilder objSqlCommandBuilder=new SqlCommandBuilder(objSqlDA);              objSqlDA.UpdateCommand=objSqlCommandBuilder.GetUpdateCommand();              objSqlDA.Update(objDataSet,"member_info");              } </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="styles.css"> <title>Insert Personal Info</title> </head> <body> <form runat="server" >   <table border="0" dir="rtl"> <tr><td align="left">äÇã</td><td width="216"><asp:TextBox ID="first" AutoPostBack="true" runat="server"></asp:TextBox></td></tr> <tr><td align="left">äÇã ÎÇäæÇϐí</td><td><asp:TextBox id="last" runat="server"></asp:TextBox></td></tr> <tr><td align="left">äÇ㝁ÏÑ</td><td><asp:TextBox ID="Father_Name" runat="server" /></td></tr> <tr><td align="left">ÊÇÑíÎ ÊæáÏ</td><td><asp:TextBox ID="Date_Birth" runat="server" /></td></tr> <tr><td align="left">ÔãÇѝåÔäÇÓäÇãå</td><td><asp:TextBox ID="Birt_num" runat="server" /></td></tr> <tr><td align="left">ãÍáÊæáÏ</td><td><asp:TextBox ID="Birt_Place" runat="server" /></td></tr> <tr><td align="left">æÖÚíʝÊÃåá</td><td> <asp:DropDownList ID="Mariage_Condition" runat="server"> <asp:ListItem Value="ãÌÑÏ" Text="ãÌÑÏ">ãÌÑÏ</asp:ListItem> <asp:ListItem>ãÊÃåá</asp:ListItem> </asp:DropDownList></td></tr> <tr><td align="left">æÖÚíʝÊÍÕíáÇÊ</td>   <td>   <asp:DropDownList ID="Colg_cond" runat="server">   <asp:ListItem>ÒíÑÏíáã</asp:ListItem>   <asp:ListItem>ÝæÞ Ïȁáã</asp:ListItem>   <asp:ListItem>áíÓÇäÓ</asp:ListItem>   <asp:ListItem>ÝæÞáíÓÇäÓ</asp:ListItem>   <asp:ListItem>ÏßÊÑí</asp:ListItem>   <asp:ListItem>ÊÍÕíáÇÊ ÍæÒæí</asp:ListItem>   </asp:DropDownList>   </td> </tr> Date_Birth<tr><td align="left">æÖÚíʝÇÔÊÛÇá</td><td> <asp:DropDownList ID="Job_Cond" runat="server"> <asp:ListItem>ÈíßÇÑ</asp:ListItem> <asp:ListItem>ÔÇÛá</asp:ListItem> <asp:ListItem>ÎÇäåÏÇÑ</asp:ListItem> </asp:DropDownList> </td></tr> <tr><td align="left">æÖÚíÊ ÓÑÈÇÒí </td> <td><asp:DropDownList ID="Soldier_cond" runat="server"> <asp:ListItem>ãÔãæá</asp:ListItem> <asp:ListItem>ßÇÑÊ ÇíÇä ÎÏãÊ</asp:ListItem> <asp:ListItem>ãÚÇÝíÊ ÒÔßí</asp:ListItem> <asp:ListItem>ãÚÇÝíÊ ÛíÑ ÒÔßí</asp:ListItem> </asp:DropDownList></td></tr> <tr><td align="left">ÓÇÈÞåßÇѝÎÕæÕí</td><td><asp:TextBox ID="Sabegeh_Khosos" runat="server" /></td></tr> <tr><td align="left">ÓÇáÓÇÈÞ坝ßÇÑÏæáÊí</td><td><asp:TextBox ID="Sabegeh_Dolati" runat="server" /></td></tr> <tr><td align="left">ÂÏÑӝãÍáÇÞÇãÊ</td><td><asp:TextBox ID="Address_Pos" runat="server" /></td></tr> <tr><td align="left">ÑÔÊåÊÍÕíáí</td><td><asp:TextBox ID="Field" runat="server" /></td></tr> <tr><td align="left">ÓÇáÇÊãÇãÊÍÕíáÇÊ</td><td><asp:TextBox ID="Year_OF_Graduate" runat="server" /></td></tr> <tr><td align="left">ãÏÇÑߝÝäí</td><td><asp:TextBox ID="Technical_Profess" runat="server" /></td></tr> <tr><td align="left">ÚäæÇä</td><td><asp:TextBox ID="Title" runat="server" />   </td> </tr> <tr><td align="left">ÂÏÑÓ ãÍáßÇÑ</td><td><asp:TextBox ID="Address_Job" runat="server" /></td></tr> <tr><td align="left">ÔãÇÑåãáí</td><td><asp:TextBox ID="nation_ID" runat="server" /></td></tr> <tr><td align="left">ITãÔÇæÑå Òãíäɝ</td><td><asp:CheckBox ID="IT_Consultant" TextAlign="right" runat="server" /></td></tr> <tr><td align="left">ICTßÇÑÔäÇӝÝäíÇÌÑÇíÑæŽååÇí</td><td><asp:CheckBox ID="Technical_Ict_Proj" runat="server" /></td></tr> <tr><td align="left">ÇÌÑÇí ÑæŽååÇíÝäí ÏÑÞÇáÈ ÇÔÎÇ՝ÍÞíÞí</td><td><asp:CheckBox ID="Technical_Project_Personal" runat="server" /></td></tr> <tr><td align="left">ÇÓÊÇä ICTÚÖæíÊ ÏÑ äÙÇã</td><td><asp:CheckBox ID="Membership_In_ICT_State" runat="server" /></td></tr> <tr><td align="left">äÙÇÑʝÝäí ÈÑ ÇäÌÇã ÑæŽååÇ</td><td><asp:CheckBox ID="Technical_SuperViser_Project" runat="server" /></td></tr> <tr><td align="left">ÇÌÑÇí ÑæŽåÇí Ýäí ÏÑ ÞÇÈ </td><td><asp:CheckBox ID="Personal_Project" runat="server" /></td></tr> <tr><td align="left">ãÑÈí ãåÇÑÊåÇí åÝʐÇäå</td><td><asp:CheckBox ID="ICDL_Trainer" runat="server" /></td></tr> <tr><td align="left"></td><td></td></tr> <tr><td align="left"></td><td></td></tr> <tr><td align="left"></td><td></td></tr> <tr><td align="left"></td><td></td></tr> <tr><td></td><td></td></tr> <tr><td></td><td></td></tr> <tr><td></td><td></td></tr> <tr><td><asp:Button ID="submit" runat="server" OnClick="update" Text="ÊÛííÑ ÑßæÑÏ" BorderStyle="Dashed" BackColor="#CC6666"></asp:Button></td><td></td></tr> </table> <br> <br> </form> <asp:DataGrid ID="dg" runat="server" ></asp:DataGrid> <asp:DataGrid ID="dg1" runat="server" ></asp:DataGrid> </body> </html>
Beauty Is not on the face
Beauty is on the heart
--<<Ghibran Khalil>>--
 
Old October 6th, 2004, 02:54 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Default

hi
my problem is that when i fill a form that initially blank <br>the value can be insert into DB or i can write it out but the problem raises when i have a form that some value is inialy inserted in the Page_Load() section like the manner that we have a form that contains a personal record information but we like a person can be change any value of own record.
like this that a person has like to change his address or telephone
and othere sepcific informations.
how i can do this i think i must be write or use event handlers to handle when a inputbox value has changed but any idea how i can do this.
Thanks In Advance.
YoOrD.

Beauty Is not on the face
Beauty is on the heart
--<<Ghibran Khalil>>--
 
Old October 6th, 2004, 03:18 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Default

hi every one i think i can find where i hahve problem and it is maybe for that reason i am dont seperate the PostBacK Section of Page And when i click to submit the Page_Load() method Reinitialized with the former value and practicaly no changes made for table value.
my page
void Page_Load()
           {
         //Initialing the form inputs by fetching from DB(tables)
           }
void update()//fires when OnClick event of submit button fires
           {

           //do initialing DataRow Collection and using InputBoxes
           //finally do Update to data source

           }
if every one have idea tell me i am apperciate.
Thanks In Advance.
YoOrD.

Beauty Is not on the face
Beauty is on the heart
--<<Ghibran Khalil>>--
 
Old October 6th, 2004, 07:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Yes, you should use

if (!Page.IsPostBack) {
  //load data
}

When the page initially loads, then retrieve data. Does the update button need to refresh the data? If so, you need to reload the data again.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in <asp:TextBox> saurabh321 ASP.NET 2.0 Basics 2 November 3rd, 2006 12:02 AM
make textbox maximum length of <td> cell crmpicco Javascript How-To 0 October 19th, 2005 10:46 AM
need emergency help for crystal report jijualex Crystal Reports 0 November 24th, 2004 02:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.