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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:18:15+00:00 2026-05-20T03:18:15+00:00

I use the following to bind a field from the table to a hidden

  • 0

I use the following to bind a field from the table to a hidden field inside a gridview but i am getting the error as System.Data.DataRowView’ does not contain a property with the name ‘AccountType’.

This is how I assigned

<asp:TemplateField>
    <ItemTemplate>
        <asp:HiddenField ID="hdnAccntType" runat="Server" Value='<%#Eval("AccountType") %>' />
    </ItemTemplate>
</asp:TemplateField>

Is it correct or do I have to make any corrections?

My stored procedure:

CREATE DEFINER=`root`@`%` PROCEDURE `uspGetEmployeeBankDate`(_EmpID INT(11),
 _BankTypeID varchar(10),_AccountType varchar(10))
BEGIN
select EmpID,BankTypeID,DATE_FORMAT(StartDate, '%Y-%m-%d') 
as StartDate,DATE_FORMAT(EndDate, '%Y-%m-%d') as EndDate 
from tblemployeebankdata where EmpID=_EmpID and BankTypeID=_BankTypeID 
 and AccountType=_AccountType;

END

Sample code

       if (mlocal_ds.Tables[0].Rows.Count != 0)
        {
            foreach (DataRow drRow in mlocal_ds.Tables[0].Rows)
            {
                if (drRow["BankTypeID"].ToString() == "DbalC")
                {
                    pnlGrid.Visible = false;
                    grdBank.Visible = true;
                    //grdData.Visible = false;

                    strEmpID = HiddenField1.Value;
                    string AccntType = drRow["AccountType"].ToString();
                    string strBankTypeID = drRow["BankTypeID"].ToString();
                    string mlocal_strStoredProcName = StoredProcNames.tblEmployeeBankdetails_uspEmployeeBankdetailsDate;
                    mlocal_ds = new DataSet();
                    oEmployee.SelectId(out mlocal_ds, mlocal_strStoredProcName, strEmpID, strBankTypeID,AccntType); // here the stored procedure is executed
                    grdBank.DataSource = mlocal_ds;
                    grdBank.DataBind();
                    pnlChckAcc.Visible = false;
                    pnlPrimary.Visible = false;
                    pnlSecond.Visible = false;
                    pnlSecondary.Visible = false;
                    pnlFirst.Visible = false;
                    pnlEditInfo.Visible = false;
                    break;
                }

My grid view

     <asp:GridView ID="grdBank" runat="server" AutoGenerateColumns="False" CellPadding="4"
            CssClass="grid" ForeColor="#333333" GridLines="None" Width="349px" Visible="False">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:RadioButton ID="rdbtnBank" runat="server" AutoPostBack="true" OnCheckedChanged="rdbtnBank_CheckedChanged" />
                    </ItemTemplate>                        
                </asp:TemplateField>
                <asp:TemplateField>
                <ItemTemplate>
                <asp:HiddenField ID="hdnAccntType" runat="Server" Value='<%# DataBinder.Eval(Container.DataItem, "AccountType") %>' />
                </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="EmpID" HeaderText="EmpID">
                    <ItemStyle CssClass="intitalitefname" />
                </asp:BoundField>
                <asp:BoundField DataField="BankTypeID" HeaderText="BankTypeID">
                    <ItemStyle CssClass="intitalitefname" />
                </asp:BoundField>
                <asp:BoundField DataField="StartDate" HeaderText="Start Date">
                    <ItemStyle CssClass="intitalitefname" />
                </asp:BoundField>
                <asp:BoundField DataField="EndDate" HeaderText="End Date">
                    <ItemStyle CssClass="intitalitefname" />
                </asp:BoundField>
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <EmptyDataTemplate>
                nodata to display
            </EmptyDataTemplate>
        </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-20T03:18:15+00:00Added an answer on May 20, 2026 at 3:18 am

    As Muhammed Akhtar said your original datasource doesn’t include the AccountType field so you can’t bind this to anything

    You need to change your Stored Procedure to:

    CREATE DEFINER=`root`@`%` PROCEDURE `uspGetEmployeeBankDate`(_EmpID INT(11),
    
    _BankTypeID varchar(10),_AccountType varchar(10))
    BEGIN
    select AccountType, EmpID,BankTypeID,DATE_FORMAT(StartDate, '%Y-%m-%d') 
    as StartDate,DATE_FORMAT(EndDate, '%Y-%m-%d') as EndDate 
    from tblemployeebankdata where EmpID=_EmpID and BankTypeID=_BankTypeID 
     and AccountType=_AccountType;
    
    END
    

    The I’ve modified is right at the beginning of your “select” which now includes the AccountType field. If you don’t include this field in your original select it’s not going to be included in the datasource you get back which in turn means you can’t bind it

    Hope that helps

    Dave

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

Sidebar

Related Questions

My GridView using following data binding syntax to bind data. I hope do data
I use following code: Create a retry policy, when error, retry after 1 second,
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
Hello Sir i want send list of data to php server i use following
I have an odd problem in silverlight. I use the following XAML to bind
I use the following code to bind an arraylist to a datagrid //fill datagrid
I am trying to do the following. Use the default model binder to bind
I use the following function to bind all members of a certain class to
I use the following XAML file to create an XML resource and then bind
When I use the following jquery template: <script id=cost-template type=text/x-jquery-tmpl> <table class=costSection> <caption class=boldCaption>Costs</caption>

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.