Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<asp:TableHeaderCell CssClass="CellWidth1" ColumnSpan="<%=IncAdd%>">

not able to set ColumnSpan dynamically at runtime to correct formeting
Posted
Comments
Christian Graus 23-Aug-12 7:27am    
Does this mean you got an error saying your formatting was wrong ? What does the HTML say ? Does this run, or not ?
surabhikalra 23-Aug-12 7:45am    
it gives error
Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Cannot create an object of type 'System.Int32' from its string representation '<%=Convert.ToInt32(IncAdd) %>' for the 'ColumnSpan' property.
surabhikalra 23-Aug-12 7:47am    
i have to set ColumnSpan dynamically to correct formatting of genarated html page in one condition
either 15 or 17
surabhikalra 23-Aug-12 7:47am    
only from aspx page not .cs
surabhikalra 23-Aug-12 7:58am    
i also tried this

It seems, the variable IncAdd is out of scope or not initialized or it is set with alpha numeric value.

Try this...
protected string IncAdd=string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
    IncAdd = "17";//your logic goes here
}


Also cross check, what value you set into the variable. If it is alpha numeric, then cross check your code.

Hope this helps.
cheers
 
Share this answer
 
See, the error means what it says. It's for this reason that you should post the error message, if you can't understand it. IncAdd is a string. Make it an int, and it will work. That's what the message says.
 
Share this answer
 
IN SERVER SIDE CODE

TableHeaderCell obj = (TableHeaderCell)lTable1.Rows[5].FindControl("tempid");
obj.ColumnSpan = 17;
 
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