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

  • SEARCH
  • Home
  • 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 6165793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:13:40+00:00 2026-05-23T22:13:40+00:00

I have read many posts on this, especially here on this site, but I

  • 0

I have read many posts on this, especially here on this site, but I still can’t find exactly what I’m looking for. I’m filling my Gridview in the .cs file, rather than adding to the Columns section of it in the .aspx. I have two fields I want to be able to still reference, but want them invisible. I know Gridview isn’t particularly good for this sort of thing…but is there some way that I can achieve this that I’m missing?

.cs

protected void searchFill()
{
    orderByString = orderByList.SelectedItem.Value;
    fieldString = searchTextBox.Text;
    string sqlStatement = "SELECT fName AS [First], lName as [Last], addr AS [Address], email AS [Email], phone AS [Phone], ccType AS [Credit Card Type], length AS [Length], IdentityColumn, processed FROM SecureOrders WHERE fName LIKE '%" + fieldString + "%' OR lName LIKE'%" + fieldString + "%' OR addr LIKE'%" + fieldString + "%' OR addr2 LIKE'%" + fieldString + "%' OR city LIKE'%" + fieldString + "%' OR state LIKE'%" + fieldString + "%' OR zip LIKE'%" + fieldString + "%' OR zip LIKE'%" + fieldString + "%' OR country LIKE'%" + fieldString + "%' OR email LIKE'%" + fieldString + "%' OR phone LIKE'%" + fieldString + "%' OR ccType LIKE'%" + fieldString + "%' OR ccNum LIKE'%" + fieldString + "%' OR ccExp LIKE'%" + fieldString + "%' OR cwaSource LIKE'%" + fieldString + "%' OR cwaJoined LIKE'%" + fieldString + "%' OR length LIKE'%" + fieldString + "%' OR delivery LIKE'%" + fieldString + "%' OR price LIKE'%" + fieldString + "%' OR url LIKE'%" + fieldString + "%' ORDER BY " + orderByString;
    using (SqlConnection connection = new SqlConnection(connectionString.ToString()))
    {
        connection.Open();
        SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlStatement, connection);
        dataAdapter.SelectCommand.Parameters.AddWithValue("@fieldString", fieldString);
        dataAdapter.SelectCommand.Parameters.AddWithValue("@orderByString", orderByString);
        SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
        DataSet dataSet = new DataSet();

        dataAdapter.Fill(dataSet, "SecureOrders");

        DataView source = new DataView(dataSet.Tables[0]);
        DefaultGrid.DataSource = source;
        DefaultGrid.DataBind();

        connection.Close();
    }
}

.aspx

 <asp:GridView ID="DefaultGrid" 
        runat = "server" 
        DataKeyNames = "IdentityColumn"
        onselectedindexchanged = "DefaultGrid_SelectedIndexChanged"
        autogenerateselectbutton = "true"
        enableviewstate = "false"
        selectedindex="1">
    <SelectedRowStyle BackColor="Azure"
        forecolor="Black"
        font-bold="true" />
    <Columns>
    <asp:TemplateField HeaderText = "Processed">
        <ItemTemplate>
            <asp:CheckBox 
                ID="CheckBoxProcess" 
                AutoPostBack="true" 
                Checked='<%#Eval("processed") %>'
                OnCheckedChanged="CheckBoxProcess_CheckedChanged"
                runat="server"
                Enabled="true" />
        </ItemTemplate>
    </asp:TemplateField>
    </Columns>
 </asp:GridView>
  • 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-05-23T22:13:42+00:00Added an answer on May 23, 2026 at 10:13 pm

    Wherever you want to use the column value just use <%# Eval("ColumnName") %> inside the GridView.
    All the datasource (dataset in your case) values are available in the DataBinder within the context of the GridView.

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

Sidebar

Related Questions

I have read many posts about this now but I do not still understand
I have read many posts on Session-scoped data in MVC, but I am still
I've read many of the posts regarding this issue and I can't find one
I've read so many posts and still can't find or understand how to handle
I have read many suggested questions, but still cannot find out the answer. I
Alright...I've given the site a fair search and have read over many posts about
I have read many posts on this topic; among them and most recently .NET
I have read other related posts, but am still not quite sure how, or
I have read many posts regarding detection of popup blocker by javascript code but
Regardless of many posts I've read the magic still in my code. I have

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.