Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i have a link button .
on linkbutton click i hav to creat a div and in that dive one table and in table on row and one column
and with in dat column i hav to add a textbox

can any one suggest sumthing valuebale

thanxz in advance
Posted

1 solution

This is an example,You can create as you wish.
use html tag with sb1.AppendLine

C#
public static System.Web.UI.HtmlControls.HtmlGenericControl select_File_Details(Page p, string FileNo)
    {



        System.Web.UI.HtmlControls.HtmlGenericControl dynDiv1 =
        new System.Web.UI.HtmlControls.HtmlGenericControl("DIV cssClass='roundedPanel'");
        dynDiv1.ID = "dynDivCode";
        dynDiv1.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Gray");
        dynDiv1.Style.Add(HtmlTextWriterStyle.Height, "20px");
        dynDiv1.Style.Add(HtmlTextWriterStyle.Width, "300px");
        //dynDiv.Controls.Add("Panel");
        // dynDiv.InnerHtml = "I was created using Code Behind";
        string s1 = "select FileNo,ReqControlNo,Requester,ReqDate,IssueDate,RequesterDeptt,ProjectName,IssueTime from Issue where ReceivedDate is NULL AND IssueDate is NOT NULL AND FileNo=@FileNo";

        SqlCommand cmd31 = new SqlCommand(s1, Db.GetConnection());
        cmd31.Parameters.AddWithValue("FileNo",FileNo);
        SqlDataReader dr1 = cmd31.ExecuteReader();
        if (dr1.Read())
        {
            StringBuilder sb1 = new StringBuilder();
            sb1.AppendLine("File No : " + dr1["FileNo"].ToString() + "");
            sb1.AppendLine("Request Control No : " + dr1["ReqControlNo"].ToString() + "");
            sb1.AppendLine("Requestor Name : " + dr1["Requester"].ToString() + "<br />");
            sb1.AppendLine("Request date : " + dr1["ReqDate"].ToString() + "");
            sb1.AppendLine("Issue Date : " + dr1["IssueDate"].ToString() + "<br />");
            sb1.AppendLine("Issue Time : " + dr1["IssueTime"].ToString() + "");
            dynDiv1.InnerHtml = sb1.ToString();//Finally assign the dynamic value to the dynamic DIV
            p.Controls.Add(dynDiv1);

        }
        else
        {
            cmd31.Connection.Close();

        }
        cmd31.Connection.Close();



        return dynDiv1;
    }
 
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