Click here to Skip to main content
15,910,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void Button1_Click(object sender, EventArgs e)
    {

        StringBuilder st = new StringBuilder();
        st.AppendLine("<table>");
        st.AppendLine("<tr>");
        st.AppendLine("</tr>");


        con.Open();
        string sqlQuery = "spread ";
        SqlCommand cmd = new SqlCommand(sqlQuery, con);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataReader sdr = cmd.ExecuteReader();
        DataTable dt = new DataTable();

        if (sdr.HasRows)
        {
            sdr.Read();
            dt.Load(sdr);
            int i = 0;
            foreach (DataColumn dc in dt.Columns)
            {
                i++;

                st.AppendLine("<tr><td>");
                st.AppendLine("" + dc.ToString());


                st.AppendLine("</td></tr>");


            }
            st.AppendLine("");
           
            foreach (DataRow dr in dt.Rows)
            {
                st.AppendLine("<tr>");
                int k = 0;
                do
                {
                    st.AppendLine("<td>");

                   // On this dynamic button i have to fetch the data of the particular row in ajax modalpopupextender
                    st.AppendLine("<input type=submit id= " + k + dr[k].ToString() + " name=" + k + dr[k].ToString() + "  runat="server"  value=" + dr[k].ToString() );


                    st.AppendLine("</td>");



                    k++;
                } while (k < dt.Columns.Count);
                st.AppendLine("</tr>");
            }
           
        }
        st.AppendLine("</table>");
        Literal1.Text = st.ToString();
    }
Posted
Updated 21-Jul-13 4:57am
v2
Comments
[no name] 21-Jul-13 10:21am    
Is there some sort of a question you wanted to ask? Maybe describe some sort of a problem?
BharatKaushik 21-Jul-13 10:33am    
i have to show the data of particular row in ajax modalpopup when click on any button on particular id
[no name] 21-Jul-13 10:45am    
Okay so go ahead that do that then.

1 solution

SO you want a jquery script to do that job. Do you need any help in doing that?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900