SOURCE CODE

<asp:Repeater ID="Repeater1" runat="server">
                        <HeaderTemplate>
                         <table border="1" width="100%">
                        <tr bgcolor=Gray>
                        <th>ProductId</th>
                        <th>ProductName</th>
                        <th>Description</th>
                        <th>Weight</th>
                        <th>isInStock</th>
                        </tr>
                        </HeaderTemplate>

                        <ItemTemplate>
                        <tr>
                   	    <td width ="10%" height ="50%"><%# DataBinder.Eval(Container.DataItem,"ProdID") %></td>
                   	    <td width ="10%" height ="50%"><asp:HyperLink id="hlEdit" runat="server" NavigateUrl="Frmuser.aspx" Text='<%# DataBinder.Eval(Container.DataItem, "ProdName") %>'></asp:HyperLink></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Descr") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Weight") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"islnStock") %></td>
                        </tr>
                        </ItemTemplate>

                        <AlternatingItemTemplate>
				        <tr bgcolor="#ccccff">
				        <td width ="10%" height ="50%"><%# DataBinder.Eval(Container.DataItem,"ProdID") %></td>
                   	    <td width ="10%" height ="50%"><asp:HyperLink id="hlEdit" runat="server" NavigateUrl="Frmuser.aspx" Text='<%# DataBinder.Eval(Container.DataItem, "ProdName") %>'></asp:HyperLink></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Descr") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Weight") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"islnStock") %></td>
                        </tr>
				        </AlternatingItemTemplate>
				
                        <FooterTemplate>
                        </table>
                       </FooterTemplate>
                    </asp:Repeater>
public partial class FrmMain : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
    SqlDataAdapter da;
    DataSet ds = new DataSet();
    string query;
    SqlCommand cmd;

    protected void Page_Load(object sender, EventArgs e)
    {

        try
        {

            da = new SqlDataAdapter("SELECT * FROM Products", conn);
            da.Fill(ds, "PRODUCTS");
            Repeater1.DataSource = ds.Tables["PRODUCTS"];
            Repeater1.DataBind();  

                 }

        catch (Exception ex)
        {
           
        }


    }

Only Probs is dat i want to fix the height & width of TD.See the Description (TD) is having too much height.I wnat to fix it.See i pic.

Dani AI

Generated

Quick diagnosis: the reason your cells are growing is not the Repeater — it's the HTML/CSS. Percentage height on a td only works if the table (or a parent) has an explicit height; otherwise the browser lets the cell expand to fit its content. Also table widths are controlled by the browser unless you force a fixed layout. , removing the old height="% approach and using CSS will give you predictable results.

Try these practical fixes: give the table a class, use table-layout: fixed plus a colgroup for column widths, and wrap long cell content inside a fixed-height block that hides overflow. Example CSS and HTML structure you can drop into the header/footer templates (put your bound value inside the div):

.productTable {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.productTable th, .productTable td {
  padding: 6px;
  border: 1px solid #ccc;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cellClip {
  display: block;
  height: 48px;    /* fixed row appearance */
  overflow: hidden;
  line-height: 1.2em;
}
<table class="productTable">
  <colgroup>
    <col style="width:8%">
    <col style="width:22%">
    <col style="width:45%">
    <col style="width:10%">
    <col style="width:15%">
  </colgroup>
  ...
  <tr>
    <td>...</td>
    <td>...</td>
    <td><div class="cellClip">your description goes here</div></td>
    ...
  </tr>
</table>

Extra tips: if you want wrapped text instead of ellipsis, set white-space: normal or use word-wrap: break-word. If you must use percent heights, give the table a fixed height (for example height: 300px;) so 50% has meaning. Use browser dev tools to inspect computed heights and to find any inherited CSS (master pages or external styles) that might override your rules. If consistent column sizing and styling is important, consider a GridView or building the colgroup in the HeaderTemplate so layouts stay predictable.

Nobody knows the answer or nobody wants to reply?????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.