HELP! DataFieldValue not retuning in asp:checkboxlist, what's wrong?

Discussion in 'ASP .Net Web Controls' started by jeremy, May 10, 2004.

  1. jeremy

    jeremy Guest

    I'm having trouble getting the value to post to my checkbox list once the server has returend the page.

    I have two examples, one using the checkbox list and another using a dropdownlist. The dropdownlist returns the value with no problems but the checkbox list doesn't. WHY? is there something i'm missing

    Both use the same DataSets and attributes

    Here is my code, code behind, and rendered code

    ** Code *
    <%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false" Inherits="osi_resume_tracker.WebForm1" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><HEAD><title>WebForm1</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"></HEAD><body><form id="Form1" method="post" runat="server"><asp:CheckBoxList id=statusList runat="server" DataSource="<%# dsStatus1 %>" DataTextField="status" DataValueField="status_id" RepeatLayout="Table" DataMember="tbl_status"></asp:CheckBoxList><BR><BR><asp:DropDownList id=ddStatus runat="server" DataValueField="status_id" DataTextField="status" DataSource="<%# dsStatus1 %>"></asp:DropDownList></form></body></HTML

    ********************************************

    ** code behind *

    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

    namespace osi_resume_tracke

    /// <summary
    /// Summary description for WebForm1
    /// </summary
    public class WebForm1 : System.Web.UI.Pag

    protected System.Data.OleDb.OleDbCommand scStatus
    protected System.Data.OleDb.OleDbConnection oleDbConn
    protected System.Data.OleDb.OleDbCommand scJobTitle
    protected System.Data.OleDb.OleDbDataAdapter daJobTitle
    protected osi_resume_tracker.dsStatus dsStatus1
    protected osi_resume_tracker.dsJobTitle dsJobTitle1
    protected System.Web.UI.WebControls.CheckBoxList statusList
    protected System.Web.UI.WebControls.DropDownList ddStatus
    protected System.Data.OleDb.OleDbDataAdapter daStatus

    private void Page_Load(object sender, System.EventArgs e

    // Put user code to initialize the page her
    daStatus.Fill(dsStatus1)
    //statusList.DataSource = dsStatus1
    statusList.DataBind()
    ddStatus.DataBind()



    #web form regio


    ******************************************

    ** rendered code *

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><HEAD><title>WebForm1</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"></HEAD><body><form name="Form1" method="post" action="default.aspx" id="Form1"><input type="hidden" name="__VIEWSTATE" value="dDwxMDMyOTQ0MjM0O3Q8O2w8aTwxPjs+O2w8dDw7bDxpPDE+O2k8Mz47PjtsPHQ8dDw7dDxpPDM+O0A8U2FsYXJ5IEVtcGxveWVlO0hvdXJseSBFbXBsb3llZTtDb250cmFjdG9yOz47QDwxOzI7Mzs+Pjs+Ozs+O3Q8dDw7dDxpPDM+O0A8U2FsYXJ5IEVtcGxveWVlO0hvdXJseSBFbXBsb3llZTtDb250cmFjdG9yOz47QDwxOzI7Mzs+Pjs+Ozs+Oz4+Oz4+O2w8c3RhdHVzTGlzdDowOz4+eK1UdZPqtVdA6sziuWE6nVeBFfs=" /><table id="statusList" border="0"><tr><td><input id="statusList_0" type="checkbox" name="statusList:0" /><label for="statusList_0">Salary Employee</label></td></tr><tr><td><input id="statusList_1" type="checkbox" name="statusList:1" /><label for="statusList_1">Hourly Employee</label></td></tr><tr><td><input id="statusList_2" type="checkbox" name="statusList:2" /><label for="statusList_2">Contractor</label></td></tr></table><BR><BR><select name="ddStatus" id="ddStatus"><option value="1">Salary Employee</option><option value="2">Hourly Employee</option><option value="3">Contractor</option></select></form></body></HTML>
     
    jeremy, May 10, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JD
    Replies:
    5
    Views:
    11,675
    NetArchitect
    Aug 8, 2007
  2. Patrick.O.Ige
    Replies:
    5
    Views:
    19,125
    Patrick.O.Ige
    Jun 19, 2005
  3. jmhmaine
    Replies:
    0
    Views:
    293
    jmhmaine
    Jan 20, 2005
  4. jmhmaine
    Replies:
    2
    Views:
    311
    Steven Cheng[MSFT]
    Jan 21, 2005
  5. Paul D. Fox

    Help, DropDown Web Control not Retuning "SelectedValue"

    Paul D. Fox, Jun 1, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    204
    Paul D. Fox
    Jun 1, 2005
Loading...

Share This Page