Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7960201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:41:30+00:00 2026-06-04T04:41:30+00:00

I am required to use the DevExpress ASPxGridView. I have a datasource Object which

  • 0

I am required to use the DevExpress ASPxGridView. I have a datasource Object which returns two columns of importance, ObjectType and ObjectID. ObjectType can be Dogs or Cats. ObjectID is a int value giving the ID of the Dog or Cat. Hopefully this makes sense. The ObjectID is selected by either the Dog table or the Cat table, they are indendent tables so I can’t join them in any way.

So basically it looks like this:

Object table:
ObjectType varchar (“Dogs” or “Cats”)
ObjectID int

Dogs Table
ID int
Name varchar

Cats table
ID int
Name varchar

I have been able to write the appropriate objectType by a combobox, and the ObjectID by using two controls, cbDogs and cbCats, which are populated by datasources.

What I can’t figure out is when I edit the ASPxGridView, how can I show in cbCats or cbDogs the object value. For example if ObjectType is Cats and ObjectID is 1 then I want to show in cbCats the name that corresponds with ID of 1. What I really want to do is something like this. Obviously this code does not work at all.

if (ObjectType = "Cats") 
{
  object objID = grid.GetRowValuesByKeyValue(e.KeyValue, "ObjectID");
  string objIDstr = objID.ToString()
  cbCats.SelectedValue = objIDstr  // or something like this
}

If this is helpful here is the declaration for cats in the aspx page.

<dx:GridViewDataComboBoxColumn Caption="Cat Name" FieldName="CatID"  Name="CatName"  Visible="false">
    <PropertiesComboBox DataSourceID="dsCatName" TextField="Name" ValueField="ID" ValueType="System.Int32">
    </PropertiesComboBox>
    <EditItemTemplate>
        <dx:ASPxComboBox ID="cbCat" runat="server" DataSourceID="dsCatName" TextField="Name" ValueField="ID"
        Value='<%# Bind("CatID") %>' AutoPostBack="false" ValueType="System.Int32" > </dx:ASPxComboBox>
    </EditItemTemplate>
</dx:GridViewDataComboBoxColumn>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:41:31+00:00Added an answer on June 4, 2026 at 4:41 am

    If I have understood your question correctly, all you have to do is:

    if(ObjectType=="Cats")
    {
         Int32 objID = Convert.toInt32(grid.GetRowValuesByKeyValue(e.KeyValue, "ObjectID"));
         cbCats.Items[cbCats.Items.FindByValue(objId)].selected = true;
    }
    

    As a precaution you can put a check like this:

    if(cbCats.Items.FindByValue(objID) != null)
    {
         cbCats.Items[cbCats.Items.FindByValue(objId)].selected = true;
    }
    else
    {
         cbCats.Items[0].selected = true;
    }
    

    I hope it will give you your desired results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am required to use the DevExpress ASPxGridView. I have a datasource Object which
I am working on a project for which we are required to use transaction
I'm working on a homework assignment in which I'm required to use char arrays
Is if almost always required to have thread syncing (i.e. use of mutex, semaphores,
In Objective-C I use a Notification to do some tasks, which required some time
Could someone tell me which version of MySql is required to use Doctrine2 ?
I have a problem with jQuery Validator. I want to use required property on
I am required to use Joomla for a project which essentially consists of several
i have a client who is required to use specific tracking that is only
Is there any jar required to use WSClient class? If yes, can anyone please

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.