Click here to Skip to main content
15,888,351 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Databinding ASP.NET gridview using multithreading Pin
afsal qureshi16-Aug-10 6:21
afsal qureshi16-Aug-10 6:21 
GeneralRe: Databinding ASP.NET gridview using multithreading Pin
Fayu20-Aug-10 10:07
Fayu20-Aug-10 10:07 
QuestionDynamic table Onclick Pin
Morgs Morgan15-Aug-10 23:05
Morgs Morgan15-Aug-10 23:05 
AnswerRe: Dynamic table Onclick Pin
Arun Jacob15-Aug-10 23:21
Arun Jacob15-Aug-10 23:21 
GeneralRe: Dynamic table Onclick Pin
Morgs Morgan15-Aug-10 23:28
Morgs Morgan15-Aug-10 23:28 
AnswerRe: Dynamic table Onclick Pin
Arun Jacob16-Aug-10 0:13
Arun Jacob16-Aug-10 0:13 
GeneralRe: Dynamic table Onclick Pin
Morgs Morgan16-Aug-10 5:44
Morgs Morgan16-Aug-10 5:44 
AnswerRe: Dynamic table Onclick [modified] Pin
raju melveetilpurayil16-Aug-10 0:40
professionalraju melveetilpurayil16-Aug-10 0:40 
try like this.

protected void Button1_Click(object sender, EventArgs e)
   {
       HtmlTable table = new HtmlTable();
       HtmlTableRow tr;
       HtmlTableCell td;
       //adding 10 rows
       for(int i=0;i<10;i++)
       {
           tr = new HtmlTableRow();
           //adding id for table row
           tr.ID = "tr" + i.ToString();
           //adding columns
           string cbxID = string.Empty;
           for (int cols = 0; cols < 2; cols++)
           {
               td = new HtmlTableCell();
               if (cols == 0)
               {
                   HtmlInputRadioButton radio = new HtmlInputRadioButton();
                   //adding radiobutton ID
                   cbxID = "rdb" + i.ToString();
                   radio.ID = cbxID;
                   //different groupname.
                   radio.Name = i.ToString();
                   radio.Value = "RadioButton" + i.ToString();
                   //adding Radio Buttton to Table cell
                   td.Controls.Add(radio);
                   //adding table cell to table Row
                   tr.Controls.Add(td);
               }
               else
               {
                   //add table cell text
                   td.InnerText = "Row Number" + i.ToString();
                   //adding script
                   td.Attributes.Add("onclick", string.Format("checkRadio('{0}');", cbxID));
                   //adding style
                   td.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
                   tr.Controls.Add(td);

               }
           }
           table.Controls.Add(tr);
       }
       Panel1.Controls.Add(table);
   }


<div>
        <asp:Button ID="Button1" runat="server" Text="create Table" 
            onclick="Button1_Click" />
        <asp:Panel ID="Panel1" runat="server">
        </asp:Panel>
        <script language="javascript">
 //script only to ckeck radio button
                function checkRadio(cbx)
                {
                    document.getElementById(cbx).checked = true;
                }
                </script>
    </div>

[edit] add comments[/edit]

modified on Monday, August 16, 2010 6:46 AM

GeneralRe: Dynamic table Onclick Pin
Morgs Morgan16-Aug-10 5:43
Morgs Morgan16-Aug-10 5:43 
QuestionPage Load [modified] Pin
moein.serpico15-Aug-10 20:08
moein.serpico15-Aug-10 20:08 
AnswerRe: Page Load Pin
Brij15-Aug-10 20:34
mentorBrij15-Aug-10 20:34 
QuestionIIS Restart issue Pin
Amit Patel198515-Aug-10 19:06
Amit Patel198515-Aug-10 19:06 
AnswerRe: IIS Restart issue Pin
Brij15-Aug-10 21:24
mentorBrij15-Aug-10 21:24 
GeneralRe: IIS Restart issue Pin
Amit Patel198515-Aug-10 21:52
Amit Patel198515-Aug-10 21:52 
GeneralRe: IIS Restart issue Pin
Brij15-Aug-10 23:20
mentorBrij15-Aug-10 23:20 
QuestionServer Error in '/' Application. [modified] Pin
moein.serpico13-Aug-10 21:34
moein.serpico13-Aug-10 21:34 
AnswerRe: Server Error in '/' Application. Pin
Keith Barrow13-Aug-10 23:57
professionalKeith Barrow13-Aug-10 23:57 
QuestionFtp size Pin
moein.serpico13-Aug-10 20:54
moein.serpico13-Aug-10 20:54 
AnswerRe: Ftp size Pin
T M Gray16-Aug-10 6:37
T M Gray16-Aug-10 6:37 
GeneralRe: Ftp size Pin
moein.serpico17-Aug-10 2:02
moein.serpico17-Aug-10 2:02 
GeneralRe: Ftp size Pin
T M Gray17-Aug-10 5:08
T M Gray17-Aug-10 5:08 
GeneralRe: Ftp size Pin
moein.serpico17-Aug-10 19:28
moein.serpico17-Aug-10 19:28 
QuestionDependency Injection Pin
future383913-Aug-10 20:36
future383913-Aug-10 20:36 
AnswerRe: Dependency Injection Pin
Not Active14-Aug-10 4:20
mentorNot Active14-Aug-10 4:20 
GeneralRe: Dependency Injection Pin
future383915-Aug-10 15:37
future383915-Aug-10 15:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.