Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:47:10+00:00 2026-05-16T07:47:10+00:00

i have a dynamic table that creates a div (new panel) for every TD

  • 0

i have a dynamic table that creates a div (new panel) for every TD and i want to give this div a class…

Can i add with Attributes.Add or with cssClass a class to the panel?

I am asking becouse i tried with both and got the same resault…. browser crash!!!

Every other attribute works great, and i just don’t understand why….

 Panel div = new Panel();
 div.ID = "div" + "_" + i.ToString() + "_" + j.ToString();
 div.Height = _CellHeight;
 div.Width = _CellWidth;

.
.
.

div.CssClass = "droppable";
td.Controls.Add(div);

trying to add the all code:

<link href="Styles/Kanpai.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    .draggable { width: 20px; height: 20px; background-color:Blue;}
    .draggable_big { width: 40px; height: 40px; background-color:Blue;}
    .draggable_wide { width: 40px; height: 20px; background-color:Blue;}
    .draggable_long { width: 20px; height: 40px; background-color:Blue;}
    .droppable { width: 20px; height: 20px; background-color:Red;}
</style>
<script src="JavaScript/jquery-1.4.2.js" type="text/javascript"></script>
<script src="JavaScript/jquery-ui-1.8.4.js" type="text/javascript"></script>
<script src="JavaScript/Accordion.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $(".draggable").draggable({ snap: '.droppable' });
        $(".draggable_big").draggable({ snap: '.droppable' });
        $(".draggable_wide").draggable({ snap: '.droppable' });
        $(".draggable_long").draggable({ snap: '.droppable' });
        $( ".draggable_big" ).draggable( "option", "cursor", 'move' );
        $( ".draggable_big" ).draggable( "option", "cursorAt", {right:15,top:15} );
        $( ".draggable_wide" ).draggable( "option", "cursor", 'move' );
        $( ".draggable_wide" ).draggable( "option", "cursorAt", {right:15,top:15} );
        $( ".draggable_long" ).draggable( "option", "cursor", 'move' );
        $( ".draggable_long" ).draggable( "option", "cursorAt", {right:15,top:15} );
        $(".droppable").droppable({
            drop: function() {alert('dropped:' + $(this).attr('id')); }
        });
        $( ".droppable" ).droppable( "option", "tolerance", 'pointer' );
    });
</script>

רשימת האיזורים לבחירה:

בחר איזור:

this is the code in the parrent file, the one that is calling the UC that is building the table…

now. the UC:

 public void CreatTable()
{
    //לולאה ליצירת טבלה דינאמית לפי בחירת המתכנת
    for (int i = 0; i < Convert.ToInt16(_RowNum); i++)
    {
        //שורה חדשה
        TableRow tr = new TableRow();
        //קביעת זהות דינאמית לשורה
        tr.ID = "tr" + i.ToString();
        //לולאה ליצירת העמודות בשורה
        for (int j = 0; j < Convert.ToInt16(_ColNum); j++)
        {
            //תא חדש
            TableCell td = new TableCell();
            //קבלת זהות לתא לפי השורה והעמודה
            td.ID = "td" + "_" + i.ToString() + "_" + j.ToString();
            //קביערת רוחב עמודה
            td.Width = _CellWidth;
            //קביעת גובה שורה
            td.Height = _CellHeight;
            //בקוד DIV יצירת אלמנט מסוג
            Panel div = new Panel();
            //קביעת הזהות לאלמנט
            div.ID = "div" + "_" + i.ToString() + "_" + j.ToString();
            //קביעת גובה ורוחב כמו התא
            div.Height = _CellHeight;
            div.Width = _CellWidth;

            //בדיקה האם יש אובייקטים לאותו האיזור
            if (_ObjectsForTable != null)
            {
                //אם כן, לכל תא בטבלה נבדוק האם יש לו רשומה מתאימה בבסיס המידע
                //מעבר על כל הרשומות בטבלה
                for (Int16 DataSetIndex = 0; DataSetIndex < _ObjectsForTable.Tables[0].Rows.Count; DataSetIndex++)
                {
                    //בדיקה האם האינדקסים בטבלה של הרשומה הנוכחית מתאימים לתא הנוכחי 
                    if (Convert.ToInt32(_ObjectsForTable.Tables[0].Rows[DataSetIndex]["RowID"]) == i &&
                        Convert.ToInt32(_ObjectsForTable.Tables[0].Rows[DataSetIndex]["ColID"]) == j)
                    { 
                        //אם כן, נייצר תמונה למסך לפי סוג האובייקט
                        switch(Convert.ToInt32(_ObjectsForTable.Tables[0].Rows[DataSetIndex]["ObjectTypeID"]))
                        {
                            case 1:
                                div.Style.Add("background-image", "url(Images/Objects/Tables/TableFull.jpg);");
                                div.Style.Add("position", "absolute");
                                div.Style.Add("width", "40px");
                                div.Style.Add("height", "30px");
                                break;
                            case 2:
                                div.Style.Add("background-image", "url(Images/Objects/Tables/BarChair.png);");
                                div.Style.Add("position", "absolute");
                                div.Style.Add("width", "20px");
                                div.Style.Add("height", "15px");
                                break;
                        }
                        //div.Style.Add("background-image", "url(Images/Objects/Tables/TableFull.jpg);"); 
                    }
                }
            }
            div.CssClass = "droppable";
            //לתא DIVהוספת ה
            td.Controls.Add(div);
            //בדיקה האם צריך גבולות או לא לפני שמכניסים את התא לשורה
            if (_IsBorder)
                td.Style.Add("border", "1px solid black;");
            else
                td.Style.Add("border", "none;");
            //הוספת התא לשורה
            tr.Controls.Add(td);
        }
        //הוספת השורה לטבלה
        tblMain.Controls.Add(tr);         
    }
    tblMain.Style.Add("position", "relative");
    //אם נבחרה תמונת רקע ויש תמונה רקע יש לשים אותה 
    if (_IsBackGroundImage == true && _BackGroundImage != "" && _BackGroundImage != null)
        tblMain.Style["background-image"] = _BackGroundImage;


}

I told you it’s a long one….:-)

Isn’t it wierd…..?

10x

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:47:11+00:00Added an answer on May 16, 2026 at 7:47 am

    As with all WebControls, use the common .CssClass property to set or modify the class.

    Sounds to me like your issue isn’t related to setting a css class, but something else. Setting a class isn’t going to cause the browser to crash.

    Can you post your entire code, rather than a snippet?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In your controller: $this->view->myvar = $value In your subsequent view… May 16, 2026 at 10:28 am
  • Editorial Team
    Editorial Team added an answer Use rectangles, try this http://www.lukehayler.com/2009/07/managing-reporting-services-layouts-using-the-rectangle-in-ssrs/ May 16, 2026 at 10:28 am
  • Editorial Team
    Editorial Team added an answer I think you're right on track. The reason why your… May 16, 2026 at 10:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a MySQL table holding lots of records that i want to give
I have a dynamic webpage that includes an iFrame where external html code is
I have a number of tables with lots of columns that I'm using Dynamic
I have this table view UserName Product NumberPurchaces -------- ------- --------------- 'John Doe' 'Chair'
I have this SQL change script that runs as part of my nant orchestrated
This is what I have in short. I have a dynamic list. On-Click it
I'm trying to create a dynamic popup window that is able to be re-sized.
I have a function that gets an array of DOM elements (based on tags)
I have a personal details form that allows you to enter a certain number
I've got a table that has some <input type=text> boxes in it, and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.