Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default DIV, CheckBox

    Hello,

    I am populating a DIV with Checkboxes based on rows I get from a Table
    while dr.read()
    .....
    mydiv.controls.add(etc...)
    .... other set up
    end ...

    On my webpage I check some of the check boxes then submit
    on postsback how can I get back all the check boxes that were checked
    it seems I can not get any thing back!!!
    when I check mydiv.controls.count I get 0 (Zero)
    what are ways to do that?

    Any Ideas Please help

    Thank you.


    MS News Guest

  2. Similar Questions and Discussions

    1. [PHP] Q: How to get the value of a checkbox of which name without '[]'?
      > Consider the following form in a HTML file:
    2. Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
      I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the...
    3. asp checkbox
      Kerri, Do a search for the checkbox list object and how to databind it. It think that's what will work best for you. Sincerely, -- S....
    4. Q: How to get the value of a checkbox of which name without '[]'?
      Consider the following form in a HTML file: .... <input type=checkbox name="box" value=1> <input type=checkbox name="box" value=2> <input...
    5. <asp:checkbox>
      Hi, I have a series of checkboxes on a web page. Based on what the user checks I write a record to a Database Table. I want to associate...
  3. #2

    Default Re: DIV, CheckBox

    Hi,

    do you recreate them on postback ?

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  4. #3

    Default Re: DIV, CheckBox

    Natty,

    No I don't recreate them I tried it both ways and I can't get what the
    client had to check them out
    Thanks for any more help

    "Natty Gur" <natty@dao2com.com> wrote in message
    news:OMErq$MVDHA.1744@TK2MSFTNGP12.phx.gbl...
    > Hi,
    >
    > do you recreate them on postback ?
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    MS News Guest

  5. #4

    Default Re: DIV, CheckBox

    OK,

    try this, pay attention to the DIV style and the top, left, width and
    height of the DataGrid
    ..

    <div style="DISPLAY: block; Z-INDEX: 102; LEFT: 244px; OVERFLOW: auto;
    WIDTH: 120px; POSITION: absolute; TOP: 145px; HEIGHT: 120px">
    <asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 0px;
    POSITION: absolute; TOP: 0px" runat="server" Height="100%" Width="100%">
    <Columns>
    <asp:HyperLinkColumn Text="a"
    HeaderText="a"></asp:HyperLinkColumn>
    <asp:ButtonColumn HeaderText="Add to cart" ButtonType="PushButton"
    Text="Add" CommandName="AddToCart" />
    </Columns>
    </asp:DataGrid>
    </div>

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  6. #5

    Default Re: DIV, CheckBox

    But where are you adding any controls dynamically and getting the result
    back???????
    this is my whole question
    Do you have an example of adding few dynamic at runtime via programming few
    checkboxes inside a DIV
    then getting the result back without doing some javascript stuff??

    Thank you


    "Natty Gur" <natty@dao2com.com> wrote in message
    news:unWI6$XVDHA.2364@TK2MSFTNGP09.phx.gbl...
    > OK,
    >
    > try this, pay attention to the DIV style and the top, left, width and
    > height of the DataGrid
    > .
    >
    > <div style="DISPLAY: block; Z-INDEX: 102; LEFT: 244px; OVERFLOW: auto;
    > WIDTH: 120px; POSITION: absolute; TOP: 145px; HEIGHT: 120px">
    > <asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 0px;
    > POSITION: absolute; TOP: 0px" runat="server" Height="100%" Width="100%">
    > <Columns>
    > <asp:HyperLinkColumn Text="a"
    > HeaderText="a"></asp:HyperLinkColumn>
    > <asp:ButtonColumn HeaderText="Add to cart" ButtonType="PushButton"
    > Text="Add" CommandName="AddToCart" />
    > </Columns>
    > </asp:DataGrid>
    > </div>
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    MS News Guest

  7. #6

    Default Re: DIV, CheckBox

    Sorry wrong post.

    Here is the sample code that i want to send, by the way where do you
    check the controls ?

    // HTML
    <div id="natty" name="natty" runat =server ></div>

    // dynamic create of checkbox
    private void Page_Load(object sender, System.EventArgs e)
    {

    for(int i = 0;i < 10 ; i ++)
    {
    CheckBox o = new CheckBox();
    o.Visible = true;
    o.ID = "myCheckBox" + i.ToString() ;
    o.Text = "try" + i.ToString() ;
    this.FindControl("natty").Controls.Add (o);
    }
    }

    // check for control value on Button click

    private void Button1_Click(object sender, System.EventArgs e)
    {
    bool x = ((CheckBox)this.FindControl("myCheckBox2")).Checke d ;
    }

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  8. #7

    Default Re: DIV, CheckBox

    Thank you that makes more sence


    "Natty Gur" <natty@dao2com.com> wrote in message
    news:OkMy6mYVDHA.384@TK2MSFTNGP12.phx.gbl...
    > Sorry wrong post.
    >
    > Here is the sample code that i want to send, by the way where do you
    > check the controls ?
    >
    > // HTML
    > <div id="natty" name="natty" runat =server ></div>
    >
    > // dynamic create of checkbox
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    >
    > for(int i = 0;i < 10 ; i ++)
    > {
    > CheckBox o = new CheckBox();
    > o.Visible = true;
    > o.ID = "myCheckBox" + i.ToString() ;
    > o.Text = "try" + i.ToString() ;
    > this.FindControl("natty").Controls.Add (o);
    > }
    > }
    >
    > // check for control value on Button click
    >
    > private void Button1_Click(object sender, System.EventArgs e)
    > {
    > bool x = ((CheckBox)this.FindControl("myCheckBox2")).Checke d ;
    > }
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    MS News Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139