Click here to Skip to main content
15,891,951 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Where in('aa','na'dn') Problem Pin
benqazou19-Apr-06 3:33
benqazou19-Apr-06 3:33 
GeneralRe: Where in('aa','na'dn') Problem Pin
benqazou19-Apr-06 3:36
benqazou19-Apr-06 3:36 
AnswerRe: Where in('aa','na'dn') Problem Pin
J4amieC19-Apr-06 3:34
J4amieC19-Apr-06 3:34 
QuestionWhen Send Email this error is occur Pin
mahmoud mohammed19-Apr-06 2:43
mahmoud mohammed19-Apr-06 2:43 
AnswerRe: When Send Email this error is occur Pin
benqazou19-Apr-06 3:38
benqazou19-Apr-06 3:38 
AnswerRe: When Send Email this error is occur Pin
Braulio Dez19-Apr-06 8:14
Braulio Dez19-Apr-06 8:14 
Questiondynamic button Pin
david boon19-Apr-06 1:41
david boon19-Apr-06 1:41 
AnswerRe: dynamic button Pin
Mike Ellison19-Apr-06 2:51
Mike Ellison19-Apr-06 2:51 
Hi there. Are you assigning the event handler function to your button's click event? myButton.Click += new System.EventHandler(myButtonClickHandlerFunc);

Here's a fuller example of the kind of thing you're describing. Does this help?
<% @Page Language="C#" %>

<script runat="server">

  const string SESSION_ROWCOUNT = "RowCount";
  
  void Page_Load(object o, EventArgs e)
  {
    if (!IsPostBack)
        // create the first row
        CreateARow(0);
    else
        // recreate all the rows that existed
        RecreateRows();
  }
  
  void CreateARow(int index)
  {
    TableRow r = new TableRow();
    TableCell c = new TableCell();
    
    TextBox tb = new TextBox();
    tb.ID = "text_" + index.ToString();
    c.Controls.Add(tb);
    
    Button b = new Button();
    b.ID = "button_" + index.ToString();
    b.Text = "Add Another";
    b.Click += new System.EventHandler(ButtonClick);
    c.Controls.Add(b);
    
    r.Cells.Add(c);
    myTable.Rows.Add(r);
    
    // store the count in a session variable so we can recreate
    // the existing rows on a postback
    Session[SESSION_ROWCOUNT] = myTable.Rows.Count;
  }
  
  void ButtonClick(object o, EventArgs e)
  {
    CreateARow(myTable.Rows.Count);
  }
  
  void RecreateRows()
  {
    int iCount = 0;
    if (Session[SESSION_ROWCOUNT] != null)
        iCount = Convert.ToInt32(Session[SESSION_ROWCOUNT]);

    for (int i=0; i<iCount; i++)
    {
        CreateARow(i);
    }
  }

</script>

<html>
  <head>
    <title>Dynamic TableRow Example</title>
  </head>
  
  <body>    
    <form runat="server">
        <asp:Table id="myTable" runat="server">
        </asp:Table>
        
        <br />
        <br />
        <asp:Button id="btnForcePostback" runat="server"
                    Text="Force a non-row-creating postback"
                    />
    </form>    
  </body>
  
</html>

QuestionHow To send Email from localhost Pin
mahmoud mohammed19-Apr-06 1:00
mahmoud mohammed19-Apr-06 1:00 
QuestionHow To send E-mail from localhost Pin
mahmoud mohammed19-Apr-06 0:54
mahmoud mohammed19-Apr-06 0:54 
AnswerRe: How To send E-mail from localhost Pin
enjoycrack19-Apr-06 0:59
enjoycrack19-Apr-06 0:59 
GeneralRe: How To send E-mail from localhost Pin
Daniel Santillanes19-Apr-06 5:24
professionalDaniel Santillanes19-Apr-06 5:24 
GeneralRe: How To send E-mail from localhost Pin
enjoycrack19-Apr-06 15:51
enjoycrack19-Apr-06 15:51 
AnswerRe: How To send E-mail from localhost Pin
Braulio Dez19-Apr-06 8:17
Braulio Dez19-Apr-06 8:17 
AnswerRe: How To send E-mail from localhost Pin
ldaoust19-Apr-06 10:43
ldaoust19-Apr-06 10:43 
QuestionSelecting a GridViewRow Pin
Jason K19-Apr-06 0:53
Jason K19-Apr-06 0:53 
QuestionHow To send E-mail from localhost? Pin
mahmoud mohammed19-Apr-06 0:52
mahmoud mohammed19-Apr-06 0:52 
Questiondebugging asp.net related to DLL Pin
pejuta wichasa19-Apr-06 0:12
pejuta wichasa19-Apr-06 0:12 
AnswerRe: debugging asp.net related to DLL Pin
Jon Hulatt19-Apr-06 0:26
Jon Hulatt19-Apr-06 0:26 
GeneralRe: debugging asp.net related to DLL Pin
pejuta wichasa19-Apr-06 1:04
pejuta wichasa19-Apr-06 1:04 
GeneralRe: debugging asp.net related to DLL Pin
Paddy Boyd19-Apr-06 2:11
Paddy Boyd19-Apr-06 2:11 
GeneralRe: debugging asp.net related to DLL Pin
pejuta wichasa19-Apr-06 2:56
pejuta wichasa19-Apr-06 2:56 
GeneralRe: debugging asp.net related to DLL Pin
Paddy Boyd19-Apr-06 3:00
Paddy Boyd19-Apr-06 3:00 
GeneralRe: debugging asp.net related to DLL Pin
pejuta wichasa19-Apr-06 5:04
pejuta wichasa19-Apr-06 5:04 
Questionhow to save word document to sql server ? Pin
khurram mukhtar18-Apr-06 23:59
khurram mukhtar18-Apr-06 23:59 

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.