473,231 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

problem with WebControls.TextBox

Howdy,

I'm new to this .net stuff and really have little to no training. Im trying
to create a new page for a web form, so i have been pretty much jsut coping
code. I having some issue with some textboxes not updating when i a hit
save.

for example I have this code in my aspx.cs file:

declared:
protected System.Web.UI.WebControls.TextBox txtFullName;

populated:
txtFullName.Text = oRDI.fullName;

this code works. When the page loads the fields have the correct info. The
aspx code for this field looks like this:

<tr>
<td style="WIDTH: 140px"><asp:label id="lblFullName" runat="server"
width="109px">Full Name:</asp:label></td>
<td style="WIDTH: 192px" colSpan="3"><asp:textbox id="txtFullName"
runat="server" width="544px" maxlength="32"></asp:textbox></td>
</tr>

When i hit the save button with this code:
<td><asp:imagebutton id="ibtnSave" runat="server"
imageurl="Images\btnSave.gif"
causesvalidation="False"></asp:imagebutton></td>

I assumed that the i accessed txtFullName from teh cs code it woudl be
updated with whatever i entered in the field, but it just comes up with the
same data that it was populated with.

What step am i missing? I have looked at teh other pages in my system to
see how they work, but i dont see any differences. I setting am i missing.

the form code looks like this:
<body ms_positioning="GridLayout">
<form id="ReportDetails" method="post" encType="multipart/form-data"
runat="server">
<table cellSpacing="0" cellPadding="0" width="760" border="0">

One quick note, when i get the value of the field using the Request.Params i
get the latest value. I could use this, but what the point of this fun
architecture then. btw, did i mention that i was new to this stuff : )

Thank You,
rodrigo
ro*************@dfps.state.tx.us
Nov 16 '05 #1
4 2854
Jax
Do you initialize the text in the textbox to start with

E.G: Say in the Form_Load even

txtFullName.Text = ""

because if you have you want to change it to this instead

if(IsPostBack!=true

txtFullName.Text = ""
Nov 16 '05 #2
cs file:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Data.OracleClient;
using PRS.DocumentManager;

namespace PRS.UIDocumentManager
{
/// <summary>
/// Summary description for DocumentDetails.
/// </summary>
public class ReportDetails : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Table tblParamters;

protected System.Web.UI.WebControls.DropDownList ddlEmailOptions;
protected System.Web.UI.WebControls.Image imgLogo;
protected System.Web.UI.WebControls.ImageButton ibtnAdd;
protected System.Web.UI.WebControls.ImageButton ibtnCancel;
protected System.Web.UI.WebControls.ImageButton ibtnEdit;
protected System.Web.UI.WebControls.ImageButton ibtnDelete;
protected System.Web.UI.WebControls.ImageButton ibtnSave;
protected System.Web.UI.WebControls.ImageButton ibtnBack;

protected System.Web.UI.WebControls.Label lblError;
protected System.Web.UI.WebControls.Label lblDebugMsg;
protected System.Web.UI.WebControls.Label lblDocumentTypeList;
protected System.Web.UI.WebControls.Label lblFilter;
protected System.Web.UI.WebControls.Label lblReloadInfo;

protected System.Web.UI.WebControls.Label lblReportName;
protected System.Web.UI.WebControls.Label lblReportVersion;
protected System.Web.UI.WebControls.Label lblReportDetails;
protected System.Web.UI.WebControls.Label lblName;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.Label lblVersion;
protected System.Web.UI.WebControls.TextBox txtVersion;
protected System.Web.UI.WebControls.Label lblFullName;
protected System.Web.UI.WebControls.TextBox txtFullName;
protected System.Web.UI.WebControls.Label lblTemplateName;
protected System.Web.UI.WebControls.TextBox txtTemplateName;
protected System.Web.UI.WebControls.Label lblOrientation;
protected System.Web.UI.WebControls.TextBox txtOrientation;
protected System.Web.UI.WebControls.Label lblType;
protected System.Web.UI.WebControls.TextBox txtType;
protected System.Web.UI.WebControls.Label lblRetainage;
protected System.Web.UI.WebControls.TextBox txtRetainage;
protected System.Web.UI.WebControls.Label lblEmailOptions;
protected System.Web.UI.WebControls.TextBox txtEmailOptions;
protected System.Web.UI.WebControls.Label lblTitle;
protected System.Web.UI.WebControls.Label lblBackLink;
private void Page_Load(object sender, System.EventArgs e)
{
ReportDetailInfo oRDI;
DataSet oDS;
TableRow trRow;

ManagePageButtons(true,true,true, true, true);

String reportName = Request.QueryString["ID"];
String reportVersion = Request.QueryString["version"];

MetaDataAccessor oDataAccess = new MetaDataAccessor();
oRDI = oDataAccess.GetReportDetail( reportName , reportVersion );

lblReportName.Text = oRDI.name;
lblReportVersion.Text = oRDI.version;
txtName.Text = oRDI.name;
txtVersion.Text = oRDI.version;
txtFullName.Text = oRDI.fullName;
txtTemplateName.Text = oRDI.template;
txtOrientation.Text = oRDI.orientation;
txtType.Text = oRDI.type;
txtRetainage.Text = oRDI.retainage.ToString();
txtEmailOptions.Text = oRDI.emailOptions;

RegisterHiddenField("hdnTimeStamp",oRDI.TimeStamp. ToString());

oDataAccess = new MetaDataAccessor();
oDS = oDataAccess.GetReportParameters( reportName , reportVersion );
DataView dv = new DataView(oDS.Tables[0]);
DataTable newDt = oDS.Tables[0].Clone();
for (int i=0;i<dv.Count;i++)
{
newDt.ImportRow(dv[i].Row);
}
DataSet oDataSet = new DataSet();
oDataSet.Tables.Add(newDt);

if (oDataSet != null)
{
#region Building Table Headers
// Build the table headings
trRow = new TableRow();
tblParamters.Rows.Add(trRow);

TableCell tcCellHead = new TableCell();
tcCellHead.Text="Sequence";
tcCellHead.CssClass="THlist";
tcCellHead.Wrap=true;
tcCellHead.HorizontalAlign=HorizontalAlign.Center;
trRow.Cells.Add(tcCellHead);

tcCellHead = new TableCell();
tcCellHead.Text="Name";
tcCellHead.CssClass="THlist";
tcCellHead.Wrap=true;
tcCellHead.HorizontalAlign=HorizontalAlign.Center;
trRow.Cells.Add(tcCellHead);

tcCellHead = new TableCell();
tcCellHead.Text="Length";
tcCellHead.CssClass="THlist";
tcCellHead.Wrap=true;
tcCellHead.HorizontalAlign=HorizontalAlign.Center;
trRow.Cells.Add(tcCellHead);

tcCellHead = new TableCell();
tcCellHead.Text="Type";
tcCellHead.CssClass="THlist";
tcCellHead.Wrap=true;
tcCellHead.HorizontalAlign=HorizontalAlign.Center;
trRow.Cells.Add(tcCellHead);

#endregion

#region Building Table Items list
// Display the available templates
int RowCount=0;
foreach(DataRow drRow in oDataSet.Tables[0].Rows)
{
++RowCount;
trRow = new TableRow();
tblParamters.Rows.Add(trRow);

// Populate Data
// Catalog link
TableCell tcData = new TableCell();
tcData.HorizontalAlign =
System.Web.UI.WebControls.HorizontalAlign.Left;
if ((RowCount%2)==0)
tcData.CssClass = "altcolor";
tcData.Wrap = true;
tcData.Text = drRow["NBR_RPT_PARM_SEQ"].ToString();
trRow.Cells.Add(tcData);

// display name
tcData = new TableCell();
tcData.HorizontalAlign =
System.Web.UI.WebControls.HorizontalAlign.Left;
if ((RowCount%2)==0)
tcData.CssClass = "altcolor";
tcData.Wrap = true;
tcData.Text = drRow["NM_RPT_PARM_NAME"].ToString();
trRow.Cells.Add(tcData);

tcData = new TableCell();
tcData.HorizontalAlign =
System.Web.UI.WebControls.HorizontalAlign.Left;
if ((RowCount%2)==0)
tcData.CssClass = "altcolor";
tcData.Wrap = true;
tcData.Text = drRow["NBR_RPT_PARM_LENGTH"].ToString();
trRow.Cells.Add(tcData);

tcData = new TableCell();
tcData.HorizontalAlign =
System.Web.UI.WebControls.HorizontalAlign.Left;
if ((RowCount%2)==0)
tcData.CssClass = "altcolor";
tcData.Wrap = true;
tcData.Text = drRow["TXT_RPT_PARM_TYPE"].ToString();
trRow.Cells.Add(tcData);

}
#endregion

}
}

private void ReportErrMessage (Exception ex)
{
StringBuilder sb = new StringBuilder();

sb.Append("<p>" + ex.ToString());
Exception iEx = ex.InnerException;
while (iEx != null)
{
sb.Append("<p>" + iEx.ToString());
iEx = iEx.InnerException;
}
sb.Append("<P>" + ex.StackTrace);
lblDebugMsg.Text = sb.ToString().Replace("\n", "<p>");
}

private void ManagePageButtons( bool CancelBtn, bool AddBtn, bool
EditBtn, bool DeleteBtn, bool SaveBtn)
{
ibtnCancel.Visible = CancelBtn;
ibtnAdd.Visible = AddBtn;
ibtnEdit.Visible = EditBtn;
ibtnDelete.Visible = DeleteBtn;
ibtnSave.Visible = SaveBtn;
}

private void ManageTypeBoxes(bool MakeEditable)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ibtnBack.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnBack _Click);
this.ibtnCancel.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnCanc el_Click);
this.ibtnAdd.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnAdd_ Click);
this.ibtnEdit.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnEdit _Click);
this.ibtnDelete.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnDele te_Click);
this.ibtnSave.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnSave _Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void ibtnAdd_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Console.WriteLine("ADD");
}
private void ibtnSave_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
MetaDataAccessor oDataAccess = new MetaDataAccessor();

ReportDetailInfo reportDetailInfo = new ReportDetailInfo();

reportDetailInfo.name = lblReportName.Text;
reportDetailInfo.version = lblReportVersion.Text;
reportDetailInfo.name = txtName.Text;
reportDetailInfo.version = txtVersion.Text;
reportDetailInfo.fullName = txtFullName.Text;
reportDetailInfo.template = txtTemplateName.Text;
reportDetailInfo.orientation = txtOrientation.Text;
reportDetailInfo.type = txtType.Text;
reportDetailInfo.retainage = int.Parse( txtRetainage.Text );
reportDetailInfo.emailOptions = txtEmailOptions.Text;
reportDetailInfo.TimeStamp =
OracleDateTime.Parse(Request.Params["hdnTimeStamp"]);

//oDataAccess.UpdateReportDetails( reportDetailInfo );

}

private void ibtnEdit_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Console.WriteLine("EDIT");
}

private void ibtnDelete_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Console.WriteLine("delete");
}

private void ibtnCancel_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Console.WriteLine("cancel");
}

private void ibtnBack_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect(lblBackLink.Text);
}

}
}
-----------------------------------------
aspx:

<%@ Page language="c#" Codebehind="ReportDetails.aspx.cs"
AutoEventWireup="false" Inherits="PRS.UIDocumentManager.ReportDetails" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Report Details</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="css/impact.css" type="text/css" rel="stylesheet">
</HEAD>
<body ms_positioning="GridLayout">
<form id="ReportDetails" method="post" encType="multipart/form-data"
runat="server">
<table cellSpacing="0" cellPadding="0" width="760" border="0">
<tr>
<td>
<table class="TableBorderExpand" id="MainTable" cellSpacing="0"
cellPadding="3" width="100%"
border="0">
<tr>
<td class="THExpand">
<p><asp:image id="imgLogo" runat="server"
imageurl="Images\prs_seal.gif"></asp:image><asp:label id="lblTitle"
runat="server" cssclass="PageTitle">Report Details</asp:label></p>
</td>
</tr>
</table>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<td align="right">
<table class="TableBorder" id="tblTopInfo" cellSpacing="0"
cellPadding="3" width="303"
border="0">
<tr>
<td style="WIDTH: 87px">Report Name:</td>
<td><asp:label id="lblReportName"
runat="server">lblReportName</asp:label></td>
</tr>
<tr>
<td style="WIDTH: 87px">Report Version:</td>
<td><asp:label id="lblReportVersion"
runat="server">lblReportVersion</asp:label></td>
</tr>
</table>
</td>
</TR>
</table>
<table id="Table3" cellSpacing="0" cellPadding="3" width="100%"
border="0">
<tr>
<td><asp:label id="lblError" runat="server" font-bold="True"
forecolor="Red"></asp:label></td>
</tr>
</table>
<table class="TableBorder" id="Table4" cellSpacing="0"
cellPadding="3" width="100%" border="0">
<tr>
<td class="THList" style="WIDTH: 140px"
colSpan="4"><asp:label id="lblReportDetails" runat="server" cssclass="H1"
width="316px">Report Details</asp:label></td>
</tr>
<tr>
<td style="WIDTH: 140px"><asp:label id="lblName"
runat="server" width="109px">Report Name:</asp:label></td>
<td style="WIDTH: 149px"><asp:textbox id="txtName"
runat="server" width="108px" maxlength="6"></asp:textbox></td>
<td style="WIDTH: 153px"><asp:label id="lblVersion"
runat="server" width="109px">Report Version:</asp:label></td>
<td><asp:textbox id="txtVersion" runat="server"
width="108px" maxlength="2"></asp:textbox></td>
</tr>
<tr>
<td style="WIDTH: 140px"><asp:label id="lblFullName"
runat="server" width="109px">Full Name:</asp:label></td>
<td style="WIDTH: 192px" colSpan="3"><asp:textbox
id="txtFullName" runat="server" width="544px"
maxlength="32"></asp:textbox></td>
</tr>
<tr>
<td style="WIDTH: 140px"><asp:label id="lblTemplateName"
runat="server" width="109px">Template Name:</asp:label></td>
<td style="WIDTH: 149px"><asp:textbox id="txtTemplateName"
runat="server" width="107px" maxlength="8"></asp:textbox></td>
<td style="WIDTH: 153px"></td>
<td></td>
</tr>
<tr>
<td style="WIDTH: 140px"><asp:label id="lblOrientation"
runat="server" width="109px">Orientation:</asp:label></td>
<td style="WIDTH: 149px"><asp:textbox id="txtOrientation"
runat="server" width="107px" maxlength="1"></asp:textbox></td>
<td style="WIDTH: 153px"><asp:label id="lblType"
runat="server" width="109px">Type:</asp:label></td>
<td style="WIDTH: 121px"><asp:textbox id="txtType"
runat="server" width="107px" maxlength="1"></asp:textbox></td>
</tr>
<tr>
<td style="WIDTH: 140px"><asp:label id="lblRetainage"
runat="server" width="109px">Retainage:</asp:label></td>
<td style="WIDTH: 149px"><asp:textbox id="txtRetainage"
runat="server" width="107px" maxlength="5"></asp:textbox></td>
<td style="WIDTH: 153px"><asp:label id="lblEmailOptions"
runat="server" width="109px">Email Options:</asp:label></td>
<td style="WIDTH: 121px"><asp:textbox id="txtEmailOptions"
runat="server" width="107px" maxlength="1"></asp:textbox></td>
</tr>
</table>
<br>
<table class="TableBorder" id="Table7" cellSpacing="0"
cellPadding="3" width="100%" border="0">
<tr>
<td class="THList" style="WIDTH: 140px" colSpan="4">Report
Paramters</td>
</tr>
<tr>
<td style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px; PADDING-TOP: 0px"><asp:table id="tblParamters"
runat="server" cssclass="tableBorderList" width="100%"></asp:table></td>
</tr>
</table>
<br>
<table id="Table8" cellSpacing="0" cellPadding="3" width="100%"
border="0">
<tr>
<td style="WIDTH: 66px"></td>
<td style="WIDTH: 79px"><asp:imagebutton id="ibtnBack"
runat="server" imageurl="Images\btn_Back.jpg"></asp:imagebutton></td>
<td style="WIDTH: 158px"></td>
<td style="WIDTH: 435px"></td>
<td style="WIDTH: 4px"><asp:imagebutton id="ibtnCancel"
runat="server" imageurl="Images\btn_cancel.jpg"></asp:imagebutton></td>
<td><asp:imagebutton id="ibtnAdd" runat="server"
imageurl="Images\btnAdd.gif"></asp:imagebutton></td>
<td><asp:imagebutton id="ibtnEdit" runat="server"
imageurl="Images\btn_Edit.jpg"></asp:imagebutton></td>
<td><asp:imagebutton id="ibtnDelete" runat="server"
imageurl="Images\btnDelete.gif"></asp:imagebutton></td>
<td><asp:imagebutton id="ibtnSave" runat="server"
imageurl="Images\btnSave.gif"
causesvalidation="False"></asp:imagebutton></td>
</tr>
</table>
<table id="Table9" cellSpacing="0" cellPadding="3" width="100%">
<tr>
<td style="HEIGHT: 10px" align="right"><asp:label
id="lblReloadInfo" runat="server" visible="False"></asp:label><asp:label
id="lblBackLink" runat="server" visible="False"></asp:label></td>
</tr>
</table>
<table id="BottomTable" cellSpacing="0" cellPadding="3"
width="100%" border="0">
<tr>
<td style="HEIGHT: 11px"><asp:label id="lblDebugMsg"
runat="server" forecolor="#804040"></asp:label><asp:label id="lblFilter"
runat="server" visible="False"></asp:label></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</HTML>

"Jax" <an*******@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
Can you post the .cs file as well?

Nov 16 '05 #3
YAY!!!! that worked thanks

"Jax" <an*******@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
Do you initialize the text in the textbox to start with?

E.G: Say in the Form_Load event

txtFullName.Text = "";

because if you have you want to change it to this instead.

if(IsPostBack!=true)
{
txtFullName.Text = "";
}

Nov 16 '05 #4
Jax
Splendid, thats fixed then eh

Jax
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Giulio Santorini | last post by:
Hi, I've got two drop down list controls. When I select a value from the first one I fill the second one. And when I select a value from the second one I would like to fill another control. But...
5
by: StillStuckOnJava | last post by:
I'm having a stupid problem with V.S./C#. I've created a class and two subclasses, and I want to instantiate either of hte subclasses after users make a selection. Then I want to use that class to...
5
by: ElanKathir | last post by:
Hi ! I wrote one code for Send the E-mail, But that code have some problem , So please help me Here i paste my code and Error: Error: Server Error in '/Elan_Sample' Application. ...
4
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event....
3
by: Aaron | last post by:
Why do my session values return to nothing on post back? I want to click a button and have the row, as in: dataset.table(0).rows(THIS ROW NUMBER IS WHAT I AM TALKING ABOUT), either increment or...
1
by: GL | last post by:
I am trying to develop a prgram that randomly selects numbers for an addition program, then when the check answer button is pressed it colors the answer text field either green or red depending if...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: nate | last post by:
the error returned is this: Server Error in '/AnnAccRpt' Application. -------------------------------------------------------------------------------- Could not find control 'DropDownList1' in...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.