when loading a previously created record on to form, some controls are missing values(controls are depended on values selected in other controls)

Hello - I have created a page for Editing records.  this page will open up a chosen record and allow user to edit the data.On the form, I have 3 drop down lists.   The second dropdown list should fill values depending on value chosen in first dropdown list.  The third dropdown list should show/fill values depending on value chosen in second dropdown list.So taking this into count, i have several records with various data.  When I open-up/load a record in Edit form, only the first dropdown list has a value selected that was the pre-existing value entered in database.  The last two dropdowns are populated but the previously chosen values are not selected.  The last 2 dropdown lists show up as blank even when I had selected some values when creating the record.I know this may sound a little confusing but please let me know if you have any questions.Please Help!!Thank you!!!!! 


7/30/2008 1:15:46 AM
asp.net.web-forms 93655 articles. 5 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 35

 Can you post the code snippet that populates the dropdownlists on load of the page?

7/30/2008 2:19:11 AM

hi Sambeetpatra .  Thank you for getting back so quickly.   - Here's the page load event, where i populate controls:

private void Page_Load(object sender, System.EventArgs e)


if (Page.IsPostBack == false)


string isID = Request.QueryString["Issueid"];

int ISID = Convert.ToInt32(isID);

string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~\\App_Data") + "\\ISSUELOG.mdb";

OleDbConnection cn = new OleDbConnection(connectString);

//Open the connection.


string selectString = "SELECT * FROM IssueRecordTable where IssueID=" + ISID;

OleDbCommand cmd = new OleDbCommand(selectString, cn);

OleDbDataReader reader = cmd.ExecuteReader();while (reader.Read())



IssueIDLabel.Text = reader[

JobNumbertxt.Text = reader["JobNumber"].ToString();

JobProgrammedbyddl.SelectedValue = reader["JobProgrammedby"].ToString();

VendorProgtxt.Text = reader["VendorProgName"].ToString();

Statuslbl.Text = reader["Status"].ToString();

DateOfIssuetxt.Value = reader["DateofIssue"].ToString();

IssEnteredByddl.SelectedValue = reader["IssEnteredBy"].ToString();

ReportSourceddl.SelectedValue = reader["ReportSource"].ToString();

ReporterNametxt.Text = reader["ReporterName"].ToString();

IssueCategoryddl.SelectedValue = reader["IssueCategory"].ToString();

IssueCategory2ddl.SelectedValue = reader["IssueDetailCombobox"].ToString();

IssueCategory3ddl.SelectedValue = reader["IssueDetail2opts"].ToString();

OverUnderLabel.Text = reader["QuotaOU"].ToString();

EstimatedDateTxt.Value = reader["EstimatedDate"].ToString();

ActualDateTxt.Value = reader["ActualDate"].ToString();

EstdTimeTxt.Text = reader["EstimatedTime"].ToString();

ActualTimeTxt.Text = reader["ActualTime"].ToString();

TimeLateTxt.Text = reader["TimeLate"].ToString();

NumMinsAwayTxt.Text = reader["IssueDetail3txt"].ToString();

SeverityLevelddl.SelectedValue = reader["SeverityLevel"].ToString();

StdGuidVioddl.SelectedValue = reader["StnGdlViolated"].ToString();

RespforErrorLabel.Text = reader["CausedError"].ToString();

ProgDollarAmounttxt.Text = reader["ProgrammingDollarAmount"].ToString();

DataConDollarAmounttxt.Text = reader["DataConDollarAmount"].ToString();

QADollarAmounttxt.Text = reader["QADollarAmount"].ToString();

RespondentsAffectedtxt.Text = reader["RespondentsAffected"].ToString();

EscalatedTotxt.Text = reader["EscalatedTo"].ToString();

QAedddl.SelectedValue = reader["QAed"].ToString();

QAedbyLabel.Text = reader["WhoQAed"].ToString();

WhatHappenedtxt.Text = reader["WhatHappened"].ToString();

WhyDidItHappentxt.Text = reader["WhyDidItHappen"].ToString();

ActionTakentxt.Text = reader["ActionTaken"].ToString();

HowtoPreventtxt.Text = reader["HowtoPrevent"].ToString();

CostDescriptiontxt.Text = reader["CostDescription"].ToString();

Summarytxt.Text = reader["Summary"].ToString();

ClosedDatetxt.Value = reader["ClosedDate"].ToString();

IssueClosedByddl.SelectedValue = reader["ClosedUser"].ToString();





if (ClosedDatetxt.Value == null || ClosedDatetxt.Value == "")


Statuslbl.Text =




Statuslbl.Text =


MultiViewRBL.SelectedIndex = 0;



7/30/2008 2:38:10 AM

Also forgot to mention: the dropdown list 1, 2,  and 3 are respectively:

IssueCategoryddl.SelectedValue = reader["IssueCategory"].ToString();

IssueCategory2ddl.SelectedValue = reader["IssueDetailCombobox"].ToString();

IssueCategory3ddl.SelectedValue = reader["IssueDetail2opts"].ToString();

7/30/2008 2:40:00 AM

 Ok, this may be conflicting with your logic to keep DDL2 empty till a selction is made in DDL1 and keep DDL3 empty till a selection is made in DDL2. Even if you assign the selected value, it does not necessarily fire the selected event for the DDL. Assuming that you have implemented events for selectedIndexChanged for the dropdownlists, Try doing  this:

IssueCategoryddl.SelectedValue = reader["IssueCategory"].ToString();

//here call the function that handles selectedIndexChanged event for IssueCategoryddl, i.e.  IssueCategoryddl_SelectedIndexChanged(IssueCategoryddl, new EventArgs());

//this will at least fill up the second dropdown prior to setting the selected value 

IssueCategory2ddl.SelectedValue = reader["IssueDetailCombobox"].ToString();

//here call the function that handles selectedIndexChanged event for IssueCategory2ddl, i.e.  IssueCategory2ddl_SelectedIndexChanged(IssueCategory2ddl, new EventArgs());

IssueCategory3ddl.SelectedValue = reader["IssueDetail2opts"].ToString();


7/30/2008 4:18:50 AM

Similar Artilces:

Reading form values in dynamically created child controls in a user control
I have a common problem for which I've searched the web for answers for hours to no avail. I have some radiobuttonlists ,dropdownlists,checkboxlists and text controls in a user control. The lists are created statically, however the items in the lists are populated at run time. The lists are displayed in default.aspx (the containing page) and populated on the Page_Load event of the user control .ascx file based on an external data source containing arrays of data. I want to be able to read the values selected by the user from deafult.aspx, the parent page. details: The .ascx...

how to call controls of web control form in coding of other forms?
hello everyone i have one problem i have created one webcontrol shoppingcart in which there are two labels one of qty and other of amt which are initially enable =falsenow on other page(aspx page) i have one txtbox of qty as txtqty i want tat as soon as user enters qty txtqty and clicks on add cart button it shd be display d value in lblqty of web control shopping cart make sure i m using datalist on aspx page so give me suggestions on tat basis and my coding is in vb. plz give ur suggestions as fast as possible. Neeti what do you mean by webcontrol.... it this user control or normal ...

Control.Value and Control.SelectedItem.Value
Can someone explain to me the difference between say, Dropdownlist.SelectedItem.Value and Dropdownlist.SelectedValue?? Just curious, Thanks!Tim These are going to return the same thing. dropdownlist.selectedvalue is a shortcut to get the currently selected value in the dropdown. If that is all you want then you can just use that. If you want to access the currently selected item you can use dropdownlist.selecteditem and that return the item and you can then access any of the item's properties, including in this case the value property. If this post answered your question please r...

Controlling web control instances on Web Form
I have created a composite control, extending functionality of the Hidden Control. However, I would like to prevent the user from adding this control to the page multiple times. I only want one instance of the control on the Web Form. What setting in my project to I adjust to enable this functionality? I can not find it in any of the books that I have referenced. Is this a setting or is this code that has to be added to the inheriting class. Looks like there is no standard apporach. But I'd consider using static field to count number of created objects and throw exception if second object ...

Clearing Web Controls Values from a Web Form
I have a web form and after a user submit it I want to clear the form so that they may submit another entry. I have seen examples in VB of how to loop thru a web form and clear the controls, but I need a C# solution. I have tried the following code, while it does not give me an error, it does not clear the controls on the form. Any suggestions? Thanks! foreach (Control parent in Page.Controls)         {             foreach (Control child in parent.Controls)           ...

How to access individual controls from a form containing the web user control containing those controls
 Below is a block of code in my .aspx form named default.aspx. In this form I load a web user control. I then add it to a place holder control.(Lines 3 and 4 below) So how do I access the individual controls in my web user control? I want to set the properties on those controls, but I am baffled as to how to access the control. For example I have a text label control named "label3". How do I access this control. Because for example, under certain situations I want to hide that control. ( Label3.Visible = false;)  1    if(!Page.IsPostBack) 2&nb...

How to maintain form controls value after user control post back?
 hello experts, I have created filter grid in asp.net & C#.My form design has contains 3 dropdown controls and Filter grid(User control).Its working fine(filter), but one problem arise.the form controls are clear when i filter a grid(post back).I tried to reterive values using view state, hidden controls, i got only null values.Anyone please help, its urgent to me. Its my user control code.FilterGrid.aspx<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FilterGrid.ascx.cs" Inherits="FilterGrid" %><style type = "text/css&...

how can i Fill the controls on web page by selecting value from dropdownlist control.
  Hi,  Currentlly i am working on a web application where i require to fill the web form with the selected item in a text box. for example i have dropdown control named supplier_name, and i want to fill all the other controls values from database on the form when i select name from that supplier_name box,i.e , if i select name1, then related to that name, its code,address ,city should appear on related text boxes. I have done the same in windows application with c# , but the problem with web application(asp.net) is that, when i select Supplier _ it...

Passing values from a parent web control to child web control
I have a parent control which called CONTROL1 and a child control witch called CONTROL2 I would link to pass a value from the parent control to the child control. In the parent control(CONTROL1) I have the following Event Handler . private void btn_Handler(object sender, EventArgs e) { …      if (Page.IsPostBack) {              // Send the officer names to the child controls.             if(m_nameList.SelectedItem.Text != "")     ...

Retreiving a value from a web form within a web user control
Hi  I have a page (web form) that retreives some data from a database. To be more specific: at some point when user clicks a button (in the web form) there is some ID number retreived from a database in code behind. At the same time the Visible property of the nestet web user control is chamged to true. I want than forward the ID to the web user control so that a grid view can load data from a database for that ID. How can I access that data (the ID) within a web user control context nested in that page?  Kind regards   Check this ;ink  http://www.codeproject.com/K...

Problem in accessing web form data in user controls when create user control dynamically
HI. I have a problem using web user control. I designed a user control named NewsForm. This user control contains some web form elements like <asp:textbox>. When I add it in an .ASPX page, all things may be true. I can know which user filles in textbox (for example and other controls) <%@ Register TagPrefix="uc1" TagName="NewsForm" Src="NewsForm.ascx" %> and <UC1:NewsForm id="newsForm" runat="server"></UC1:NewsForm> But when i create it in code behined dynamically, however user control has web form controls but their value are blank for example //aspx co...

HTML Controls vs Web Form Controls
Hi, I have a page with both controls (HTML and Web Form Controls). I am trying to use an html Calendar control and then get the date selected by the user and put into a Web form input field control. When I try to run this the HTML control cannot talk to the Web form control. Any ideas? Thanks. Can't you put some javascript in the HTML-control with which you assign the value to the ASP.NET Server control? Please post some code so I can help u. Kind Regards,ThaYoung1! Hi here is the Code. Also I added a web form text input control and an html text control and created a fu...

Web form Controls vs HTML controls
Hi, can anyone explain me the difference between Web Form Controls and HTML controls? What is their usability and disadvantages? Can i write code behind HTML controls?    Thanx in advance. Yes, you just have add "runat=server", in your HTML control. The Web Server Control, have more funtionality that the HTML controls. With Web Server Control, you can work easy with Data. Too, you have controls as AdRotator, WebCalendar and more... : http://samples.gotdotnet.com/quickstart/MCP Sergio Tarrillo Here are the Recommendations from Microsoft ....when to use 1 over the other...

Pass 1 control value to another control value
I have this form, is the detailsview, and in edit mode, I have a link that you click to open up a small dhtml window (not a new window but more like a layer so everything is on the same page).  When I select an item from the dhtml window, it puts the value into a textbox.  I then have a button I click and I want to pass that value from that textbox to the textbox in the detailsview.  When I click the button, the value is not passed. Here is the code I use for getting the value from the dhtml window and assigning it to the detailsview textbox: If e.CommandName = "pi...

Web resources about - when loading a previously created record on to form, some controls are missing values(controls are depended on values selected in other controls) - asp.net.web-forms

The National Mineral Resources University (previously the Mining Institute) - Wikipedia, the free encyclopedia ...
formerly known as the Mining Institute, is Russia 's oldest technical university, and one of the oldest technical colleges in Europe. It was ...

REPORT: Driver Of Train In Fatal Spain Derailment Previously Bragged About Speeding On Facebook
In the latest example of Facebook posts coming back to haunt their authors, Francisco Jose Garzon Amo, driver of the ill-fated train that derailed ...

LoginBox Pro (previously TapIN) on the App Store on iTunes
Get LoginBox Pro (previously TapIN) on the App Store. See screenshots and ratings, and read customer reviews.

More patients readmitted to hospital than previously reported, NSW government finds
Up to 40 per cent more people are limping back into acute care after hospitalisation than previously believed.

Helicopter crash pilot Richard Green had previously lost licence
The owner of a helicopter that crashed in thick bushland near Cessnock, killing all three environmentalists on board, had his licence temporarily ...

UK bans raunchy, Australian-made Pamela Anderson ad; previously banned in Australia
A RAUNCHY ad starring Pamela Anderson that was banned in Australia has now been yanked off the air in the UK for being "sexist and degrading". ...

Humans have been handy for longer than previously thought, says study
Women like a man who's good with his hands and most people appreciate a firm handshake.

The Force Awakens: Star Wars Japanese trailer features previously unseen footage
(Bloomberg) There was a great disturbance in the force today, as if millions of Star Wars fans??suddenly cried out in joy while trying??to read ...

BASE jumping previously banned from French peak where Australian died
BASE jumping had previously been banned at a French mountain peak where an Australian man plunged to his death while participating in the adventure ...

Resources last updated: 12/15/2015 3:14:46 PM