Hi,
I am very new to .Net and have recently taken over someone else’s project. I am developing an asp webpage using C#.
I have an asp:table that is populated using data from a database. However, there is also a column that contains checkboxes and a column that contains text boxes like so:
Location | Stock | Issue (checkbox column) | Issued (textbox column)
I want the user to click a checkbox and the value of the ‘Stock’ column for that row is then entered into the textbox of that row.
I have already populated the table with data and the user controls, I am only struggling with the event.
My code is shown below: - TableRow row = new TableRow();
-
TableCell cellLoc = new TableCell();
-
TableCell cellStock = new TableCell();
-
TableCell cellIss = new TableCell();
-
TableCell cellIssued = new TableCell();
-
-
cellLoc.Width = Unit.Pixel(75);
-
cellStock.Width = Unit.Pixel(75);
-
cellIss.Width = Unit.Pixel(75);
-
cellIssued.Width = Unit.Pixel(75);
-
-
TextBox txtIssued = new TextBox();
-
CheckBox issue = new CheckBox();
-
-
cellLoc.HorizontalAlign = HorizontalAlign.Left;
-
cellLoc.Text = location.Aisle + " " + location.Bay + " " + location.Level;
-
-
if (matReq.Status >= MaterialRequisitionStatus.Picking)
-
{
-
cellStock.Text = location.QtyRequired.ToString();
-
-
if (matReq.Status == MaterialRequisitionStatus.Picking)
-
{
-
if (userCanUpdate_)
-
{
-
issue.ID = "cbIssue_" + location.ProductCode + "_" + n.ToString();
-
string box = issue.ID;
-
issue.AutoPostBack = true;
-
cellIss.Controls.Add(issue);
-
txtIssued.Width = Unit.Pixel(50);
-
txtIssued.ID = "txtIssued_" + location.ProductCode + "_" + n.ToString();
-
txtIssued.Style.Add("text-align", "right");
-
cellIssued.Controls.Add(txtIssued);
-
-
}
-
else
-
cellIssued.Text = "-";
-
}
-
else
-
cellIssued.Text = location.QtyPicked.ToString();
-
}
-
else
-
{
-
cellStock.Text = location.Stock.ToString();
-
cellIssued.Text = "-";
-
}
-
-
row.Cells.Add(cellLoc);
-
row.Cells.Add(cellStock);
-
row.Cells.Add(cellIss);
-
row.Cells.Add(cellIssued);
-
-
tblStock.Rows.Add(row);
This is my first post, so I hope I have given enough information for you to understand what I am attempting to do.
Thanks in advance,
Jonathan.
2 1524
Have you tried the OnCheckedChange d event?
Thank you for your reply. I have tried OnCheckedChange d event with no success. I have been trying to use both the AutoPostBack and javascript in the following ways
if (matReq.Status == MaterialRequisi tionStatus.Pick ing)
{
if (userCanUpdate_ )
{
issue.ID = "cbIssue_" + location.Produc tCode + "_" + n.ToString();
string box = issue.ID;
issue.AutoPostB ack = true;
cellIss.Control s.Add(issue);
txtIssued.Width = Unit.Pixel(50);
txtIssued.ID = "txtIssued_ " + location.Produc tCode + "_" + n.ToString();
txtIssued.Style .Add("text-align", "right");
cellIssued.Cont rols.Add(txtIss ued);
if (issue.Checked == false)
txtIssued.Text = cellStock.Text;
}
else
cellIssued.Text = "-";
}
and using javascript I replaced the if (issue.Checked == false) statement with:
issue.Attribute s.Add("OnChecke dChanged", issue.ClientID + "javascript:_po pbox(cbIssue_" + location.Produc tCode + "_" + n.ToString() + ", txtIssued_" + location.Produc tCode + "_" + n.ToString() + ", " + cellStock.Text + ");");
with javascript:
function _popbox(check, txt, val)
{
if (check.checked = true)
{
txt.Text = val;
}
}
I haven’t been able to get either method to work. Do you think that either of these ways are possible?
Thanks,
Jonathan.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Drew |
last post by:
I have a db table like the following,
UID, int auto-increment
RegNo
Person
Relation
YearsKnown
Now here is some sample data from this table,
|
by: Bill Brinkworth |
last post by:
I want the user to type in part of a word, and I want to return all words
from an Access word table that contains specified letters. If they were to
type "fe??", it should return all words in the dictionary that are 4 letters
and begin with "fe" into a listbox. I am having difficulting searching for
all words and taking all those words and populating a listbox. Can you help?
Here's what I have:
CLASS -
Public Property word() As String...
|
by: Neil Guyette |
last post by:
Hello, Everyone,
I'm trying to find information on how to populate a combo
box using a SqlDataReader. I want to be able to set the
value of the combo's value property different then the
combo's text property (what the user will see). Is this
possible with a SqlDataReader?
Thanks
|
by: Chris Barrow |
last post by:
Hi everyone,
Does anyone know if there is a problem populating a
system.web.ui.htmlcontrols.htmlinputtext control when the
control's type is set to "password?" I am attempting to
retreive a member's record from a database and populate
the control with the member's password. Unfortunately, if
the control declared on the .aspx side is as follows:
<input type="password" id="txtPassword" runat="server"/>
|
by: luna |
last post by:
theres no errors in my code - but it does nothing at all - its supposed to
be populating text boxes!!
any ideas ? (im am pretty new to all this)
If Not Page.IsPostBack Then
Dim search As String
Dim strConn As String =
"server=Gringotts;uid=sa;pwd=password;database=database"
| |
by: sck10 |
last post by:
Hello,
I am creating a form for users to enter information about a lab and the
members of the lab. I have one form (FormView) that they use to enter
information about that lab. The keyvalue is "LabLocation_ID". With an
existing lab, they then need to add the members for that lab. So, what I am
trying to do is the following. With the FormView of the Lab open, the user
will click a button to open a FormView (InsertMode) and add a new...
|
by: Mary |
last post by:
I'll pulling my hair out on this one and would be so appreciative of
any help.
I am creating a data entry form to enter results of a student survey.
There are 40 questions on the survey. The first 7 have to do with
respondent information like grade, class and age. I have those in a
table with a PK of RespondentId, which is autonumbered. Questions 8-40
all have the same format. For these questions I have a table set up
with the...
|
by: prosad |
last post by:
hello,
Just solved a problem using Javascript onclick, can click on any cell in a dynamic table and it will pass the innerText object value to my form text field. parts of code given below:
<script type="text/javascript">
function select_cell(obj)
{
document.getElementById('complaint').value = obj.innerText;
document.getElementById('selected_form');
}
|
by: Dave |
last post by:
I have 3 tables of information feeding into 4 combo boxes on my main
form (DR Form). I have as many list boxes (acting as text boxes) as
there are fields in each one of the 3 tables. Once selecting from the
combo box, I have all the combo boxes, using afterupdate, populating
their respective list boxes. These text boxes are directly correlated
to the combo box selection using SQL. Here is an example from the
afterupdate event in the...
|
by: Alexio |
last post by:
Sample code snippet -
<td align="right">Check Amount: </td>
(1) <td><input type="text" name="CHK_input_1" size="19"style="text-align:right" onkeyup="calcCB();" onBlur="currency(this); calcCB();" tabindex="26">
(2) <input type="hidden" name="OBKey__53_1" id="kw_check_amount" >
For various database reasons, I need to be able to populate a hidden field to be used as a keyword in our system based on the first...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |