0

Hey i want to ask that,suppose in HTML table cell...I insert Hyperlink....Is that possible to write the code for that hyperlink...Cz if the iamges are static,HTML table is better option than Gridview,I thk so????

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by mail2saion
0

YES POSSIBLE.
USE RESPONSE.WRITE/ADD A LITERAL CONTROL IN YOUR PAGE & THEN PASTE TABLE HTML WILL RESOLVE YOUR PROBLEM.

LET YOU READ DATA IN THE BELOW WAY:

SqlCommand cmd = new SqlCommand();
            cmd.Connection = Conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = sSPName;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            DataTable dt = new DataTable(cmd.CommandText);
            da.Fill(dt);

SO NOW YOU GOT A DATATABLE. LOOP THROUGH THE DATATABLE 7 GENERATE TABLE CONTENTS LIKE:

STRING STABLE="<TABLE><Tr>....</TR>";
foreach (DataRow oItem in dt.Rows)
        {
            STABLE=STABLE+"<TR><TD>";
            STABLE=STABLE+OITEM["COLNAME"];
            STABLE=STABLE+"</TD></TR>";
         } 
STABLE=STABLE+"</TABLE>";

NOW WRITE THIS STRING IN PAGE OR IN LITERAL.
IF YOUR TABLE CONTENTS WILL BE LONG THEN USE STRING BUILDER INSTEAD OF ABOVE WAY.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.