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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:31:46+00:00 2026-05-25T19:31:46+00:00

I am binding data to a grid view. string MysqlStatement = SELECT TimeReceived,TimeRead, Concat(FirstName,’,

  • 0

I am binding data to a grid view.

 string MysqlStatement = "SELECT TimeReceived,TimeRead, Concat(FirstName,', ',LastName) as Name FROM tbl_usermessage INNER JOIN tbl_user on tbl_usermessage.UserID = tbl_user.UserID WHERE MsgID = @Value1";
        using (DataServer server = new DataServer())
        {
            MySqlParameter[] param = new MySqlParameter[1];
            param[0] = new MySqlParameter("@value1", MySqlDbType.Int32);
            param[0].Value = MessageID;
            command.Parameters.AddWithValue("@Value1", MessageID);
            ds = server.ExecuteQuery(CommandType.Text, MysqlStatement, param);
        }

        Grid_UserTable.DataSource = ds;
        Grid_UserTable.DataBind();

I am binding data to a repeater list,

string MysqlStatement = "SELECT Title, RespondBy, ExpiresBy, OwnerName, Concat(LowTarget,' - ',TopTarget) as Threshold FROM tbl_message WHERE MsgID = @Value1";
        using (DataServer server = new DataServer())
        {
            MySqlParameter[] param = new MySqlParameter[1];
            param[0] = new MySqlParameter("@value1", MySqlDbType.Int32);
            param[0].Value = MessageID;
            command.Parameters.AddWithValue("@Value1", MessageID);
            ds = server.ExecuteQuery(CommandType.Text, MysqlStatement, param);
        }
        rptList.DataSource = ds;
        rptList.DataBind();

I have a button to download the report

protected void btn_ExcelDownload_Click(object sender, EventArgs e)
    {

        string path = Server.MapPath("");
        path = path + @"\Resources\MessageStatus.xlsx";
        string filename = Path.GetFileName(path);


      Response.AppendHeader("content-disposition", "attachment; filename=" + filename);
      Response.ContentType = "Application/msexcel";
      Response.WriteFile(path);
      Response.End();

    }

I tried few things and managed to download the excel sheet from the button click, but How can I fill all the data from the repeater list and grid view. I haven’t done this before pls help.

  • 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-25T19:31:47+00:00Added an answer on May 25, 2026 at 7:31 pm

    Sample aspx:

    <asp:Repeater ID="Repeater1" runat="server">
            <HeaderTemplate>
                <table>
                    <thead>
                        <tr>
                            <th>Foo</th>
                            <th>Bar</th>
                        </tr>
                    </thead>
            </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>Whatever <%# Container.DataItem %></td>
                        <td>Stuff <%# Container.DataItem %></td>
                    </tr>
                </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
    

    Sample code behind

    protected void Button1_Click(object sender, EventArgs e) {
                Repeater1.DataSource = Enumerable.Range(1, 10);
                Repeater1.DataBind();
                StringBuilder sb = new StringBuilder();
                StringWriter sw = new StringWriter(sb);
                HtmlTextWriter writer = new HtmlTextWriter(sw);
                Repeater1.RenderControl(writer);
                Response.Clear();
                Response.AppendHeader("content-disposition", "attachment; filename=foo.xlsx");
                Response.ContentType = "Application/msexcel";
                Response.Write(sb.ToString());
                Response.End();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a parent grid view (UserTransactionGridView) which i'm binding with the output from
I need to populate a .net DataGridView from a collection physically (without data binding)
I am binding a data grid to a collection of Task objects. A particular
I have a datagrid within a view <Grid x:Name=LayoutRoot Background=White Width=600 MaxHeight=150> <sdk:DataGrid x:Name=grid1
In VB.NET I created 2 shorthand functions for data binding gridviews/dropdownlists/etc from any datasource
I have a problem with binding data using BindingSource, typed dataset and DataGridView. My
I am using a DataGrid object from the WPF toolkit. I am binding the
I am a learner and i have a problem data binding the dataset. Please
I am reading data from an excel sheet and displaying it in a data
My class is like this, public class Person : DynamicObject { public string Name

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.