forms - How to programmatically create and use a list of checkboxes from ASP.NET? -


I have a page with a table of luggage and I have to allow the user to select rows for the processes . I have thought how to add a column of check box in the table but I do not have to figure out how the test is recorded, when that form is deposited. If they were static elements, then I could only check on this.theCheckBox but they can be programmatically generated.

Besides, how am I am that I am?

I am not sure that it is relevant but I am looking at a little bit of a catch-22 because I know this What


edit: I checked the checkbox that was made during that time around the last time .

Ve almost found the solution found by AutoPostBack property and checked event:

  checkbox. AutoPostBack = false; Checkboxes. Checked + new event heredollar (checkboxcotted changed);  

I can get the code to call a post for any check box that has changed. Although it has two problems:

  • After the call back process is processed (or during that time, I am not sure) Page_Load where I used to use this information Needs call
  • Callback is not called for check boxes, which are still loaded and still checked when checked.

  • Edit 2:

    What I had finished was tagged with IDE with my identity ID And it was Form_Load :

      foreach (string v in This.Request.Form.AllKeys) {if (with v. Start (prefix)) {var Data = v.Substring (Prefix.Length);   

    I think that you are using a DataList but should work with it and control which can be templated. I also agree that you are using databasing.

    Code front:

      & asp: DataList ID = "list" OnItemDataBound = "List_ItemDataBound" runat = "server" & gt; & Lt; ItemTemplate & gt; & Lt; ASP: checkbox ID = "deleted me" runat = "server" /> & Lt; A href = "& lt;% # DataBinder.Eval (container," Datystem. URL ")%> & gt; Target = "_ blank" & gt; & Lt;% # DataBinder.Eval (Container, "Dataite Titeley")% & gt; & Lt; / A & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: DataList & gt; & Lt; Asp: Button ID = "DeleteListItem" runat = "server" OnClick = "DeleteListItem_Click" & gt; & Lt; / Asp: button & gt;  

    Code behind:

      Public partial squared default: the system. Web. UI Page {Secure Zero Page_load (Object Sender, Event Eg) {if (IsPostBack) Load List (); } Secure Zero DeleteListItem_Click (Object Sender, EventArgs e) {foreach (ListListItem li list.Items) {checkbox delMe = (checkbox) li.FindControl ("DeleteMe"); If (delMe! = Null & DelMe.Checked) / / Do something}} Load List (); } Secure zero load list () {DataTable dt = // something ... List.DataSource = dt; List.DataBind (); } Secure void List_ItemDataBound (Object Sender, DataListItemEventArgs E) {If (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item} {string id = DataBinder.Eval (e.Item.DataItem ) , "Id"). ToString (); Checkbox dll = (checkbox) e.Item.FindControl ("DeleteMe"); If (delMe! = Null) delMe.Attributes.Add ("value", id); }}}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -