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 8114281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:06:18+00:00 2026-06-06T03:06:18+00:00

Right now, I have a database field named ‘PROCESS_FLAG’ that contains the text value

  • 0

Right now, I have a database field named ‘PROCESS_FLAG’ that contains the text value (A, I, E, C) and I want to be able to change the default selected value of my dropdownlist column depending on the value of PROCESS_FLAG and I’m not sure where to go from here.

Here is the code for the GridView that I have:

 <asp:BoundField DataField="REQUESTQTY" HeaderText="Request Quantity" 
                SortExpression="REQUESTQTY" />
            <asp:BoundField DataField="MOVEFROM" HeaderText="Move From" 
                SortExpression="MOVEFROM" />
            <asp:BoundField DataField="MOVETO" HeaderText="Move To" 
                SortExpression="MOVETO" />
            <asp:BoundField DataField="COMPLETEDBY" HeaderText="Completed By" 
                SortExpression="COMPLETEDBY" Visible="false"/>
            <asp:BoundField DataField="COMPLETION_DATE" HeaderText="Completion Date" 
                SortExpression="COMPLETION_DATE" />
            <asp:BoundField DataField="COMMENTS" HeaderText="Comments" 
                SortExpression="COMMENTS" Visible="false" />
            <asp:BoundField DataField="RESPONSETIME" HeaderText="Response Time" 
                SortExpression="RESPONSETIME" Visible="false" />
            <asp:BoundField DataField="PROCESS_FLAG" HeaderText="Process Flag"
                SortExpression="PROCESS_FLAG" />
            <asp:BoundField DataField="UNIQUEKEY" HeaderText="Unique Key"
                SortExpression="UNIQUEKEY" Visible="true" />

            <asp:TemplateField HeaderText="Send To...">
                <ItemTemplate>
                    <asp:DropDownList ID="StatusDD" runat="server" AutoPostBack="false" OnSelectedIndexChanged="StatusDD_SelectedIndexChanged">
                        <asp:ListItem Value="A">Active</asp:ListItem>
                        <asp:ListItem Value="C">Complete</asp:ListItem>
                        <asp:ListItem Value="I">In Process</asp:ListItem>
                        <asp:ListItem Value="E">Error</asp:ListItem>
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>

I want to set the default selected value of the drop down list depending on the value of PROCESS_FLAG.

Any help with this would be greatly appreciated. I am not a pro at all with the Eval function.

Thanks!

  • 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-06T03:06:19+00:00Added an answer on June 6, 2026 at 3:06 am

    add a OnRowDataBound attribute to the gridview in the .aspx page:

         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="id" OnRowDataBound="GridViewRowEventHandler">
    

    Then, replace

    <asp:BoundField DataField="PROCESS_FLAG" HeaderText="Process Flag"
                SortExpression="PROCESS_FLAG" />
    

    with

         <asp:TemplateField>
         <ItemTemplate>             
         <asp:Label ID="process_Flags" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "PROCESS_FLAG").ToString()%>'/>
          </ItemTemplate>                    
          </asp:TemplateField>
    

    Then in your code behind, do something like this:

     protected void GridViewRowEventHandler(Object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
               Label flag = (Label)e.Row.FindControl("process_Flags");
               DropDownList ddl = (DropDownList)e.Row.FindControl("StatusDD");
                if (flag.Text == "A")
                {
                    ddl.SelectedValue = "A";
                }
            //add more conditions here..
    
            }          
        }
    

    this should get you a little further 🙂

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

Sidebar

Related Questions

Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that
Right now i have a line of code, in vb, that calls a text
I have a database with a single table right now, which contains the following
I have a simple form right now: <form action='<? echo $PHP_SELF;?>' method='POST'> Username:<input type='text'
I'm learing LINQ-to-SQL right now and i have wrote a simple application that define
I have implemented a jquery ui autocomplete with data from database. Right now what
I have a binary field in my database that is hard to describe in
Right now I have a voting system on my website that stores all votes
Right now I am working on a new database that will show changes to
I have a class that is maps to a field in a database. The

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.