Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Dropdown Fields Show Values Not Text when I use more than 1 Dropdown
posted

I have a grid in which I have the following fields
    IssueCode    - Defined as a DropDown
    IssueStatus  - Defined as a DownDown
    StartDate     - Defined as a DateChooser
    EndDate      - Defined as a DateChooser

The two dropdowns are defined using the following ValuesList information

In the ASPX page the columns are defined like...
    <igtbl:UltraGridColumn BaseColumnName="IssueCode" IsBound="True" Key="IssueCode" Type="DropDownList" Width="300px">
         <Header Caption="Issue Code">
             <RowLayoutColumnInfo OriginX="1" />
         </Header>
         <CellStyle BackColor="Salmon">
         </CellStyle>
         <Footer>
            <RowLayoutColumnInfo OriginX="1" />
         </Footer>
    </igtbl:UltraGridColumn>
    <igtbl:UltraGridColumn BaseColumnName="IssueStatus" IsBound="True" Key="IssueStatus" Type="DropDownList" Width="80px">
         <Header Caption="Status">
            
<RowLayoutColumnInfo OriginX="2" />
         </Header>
         <CellStyle BackColor="Salmon">
         </CellStyle>
         <Footer>
            <RowLayoutColumnInfo OriginX="2" />
         </Footer>
    </igtbl:UltraGridColumn>

 In the code behind the valuelist are defined like this...
    //Set dropdown for Issue Code
    ValueList vlIssueCode = uwgIssues.Bands[0].Columns.FromKey("IssueCode").ValueList;
    vlIssueCode.DataSource = ds1;
    vlIssueCode.DataMember =
"IssueControl";
    vlIssueCode.ValueMember =
"DataValue";
    vlIssueCode.DisplayMember =
"DataText";
    vlIssueCode.DataBind();
    //Set dropdown for Issue Status|
    ValueList vlIssueStatus = uwgIssues.Bands[0].Columns.FromKey("IssueStatus").ValueList;
    vlIssueStatus.DataSource = ds1;
    vlIssueStatus.DataMember =
"IssueStatus";
    vlIssueStatus.ValueMember =
"DataValue";
    vlIssueStatus.DisplayMember =
"DataText";
    vlIssueStatus.DataBind();

When the grid displays the IssueCode field displays the DataText value in the field and the dropdown works just fine. But in the Status field it displays the DataValue in the field but when you click the cell it displays the dropdown and it too works just fine. It's just when the grid is displayed that the second filed defined as a dropdown field doesn't display the correct text value it displayes the code value. This grid also has child records and the dropdowns in those fields also don't display the correct value. But the dropdowns work correctly so my clients can see the proper values when they click in the cells.

Thanks for any help...

 

Parents
No Data
Reply
  • 210
    posted

    Ok.

    So I wanted to make sure what data types I was really working with so I put in some write statements and I received the following:

    --This one doesn't work
    uwgIssues.Bands[0].Columns.FromKey("IssueStatus").DataType = System.Int32
    vlIssueStatus.ValueMember.GetType() = System.String

    --This one works
    uwgIssues.Bands[0].Columns.FromKey("IssueCode").DataType = System.String
    vlIssueCode.ValueMember.GetType() = System.String

    --This one doesn't work
    uwgIssues.Bands[1].Columns.FromKey("Type").DataType = System.Int32
    vlIssueDeterminationType.ValueMember.GetType() = System.String

    --This one doesn't work
    uwgIssues.Bands[1].Columns.FromKey("DecisionID").DataType = System.Int32
    vlIssueDeterminationDecision.ValueMember.GetType() = System.String

    So I can see what you're talking about...so I went into the quick design and set the columns for the IssueStatus, Type, and DecisionID to all be System.String but that didn't work it still thinks they are System.Int32. So I am looking for how to change the ValueList DataType from System.String to System.Int32 but I can't find how to do that.

    See the table that holds the values for the dropdowns is a large table that holds more than just these four dropdowns. The value field in the code table is defined in the DB as varch(20) because some of the codes like "IssueCode" are characters and not ints.

    Of course the field in the DB that holds the IssueStatus in the DB is defined as an int so it comes back as an int. So is there a way I'm not seeing to redefine the ValueList DataType to an Int32?

    Thanks!

Children