Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Help with Checkboxes


Message #1 by "Hugh McLaughlin" <hugh@k...> on Wed, 17 Apr 2002 03:59:10
Hello Everyone and thanks for your help in advance.  I am trying to get 
the hang of using checkboxes within a datagrid and am running into 
problems.  An example is located at:
http://www.hughmclaughlin.com/AddressBook.aspx

My problems are:

1.  How do you set the value of the checkbox?  Whe I use the code:

<ASP:TemplateColumn HeaderText="<b>Select</b>">
	<ItemTemplate>
	<ASP:CheckBox id="SelectedMember" value="<%# Container.DataItem
("LastName") %>" runat="server"/>
	</ItemTemplate>
</ASP:TemplateColumn>

id does not allow me to set the value without a compiler error.  How can 
it be dynamically set?

2.  How do you reference the checkbox field?  When I tried 

Response.Write("The Member List is " & Request.Form("SelectedMember"))

It returned nothing, possibly in part due to not being able to set the 
value.  Any help or examples would be greatly appreciated.  Thanks.

Message #2 by Ashwini.Phalle@l... on Wed, 17 Apr 2002 12:53:42 +0530
Ans for question 2

Dim objchk As CheckBox

 objchk = dgSerCrs.Items(intRowCnt).FindControl("SelectedMember")




                                                                                            
                    "Hugh                                                                   
                    McLaughlin"          To:     "aspx_beginners"                           
                    <hugh@k...        <aspx_beginners@p...>                     
                    rk.com>              cc:                                                
                                         Subject:     [aspx_beginners] Help with Checkboxes 
                    17/04/2002                                                              
                    09:29 AM                                                                
                    Please respond                                                          
                    to                                                                      
                    "aspx_beginner                                                          
                    s"                                                                      
                                                                                            
                                                                                            




Hello Everyone and thanks for your help in advance.  I am trying to get
the hang of using checkboxes within a datagrid and am running into
problems.  An example is located at:
http://www.hughmclaughlin.com/AddressBook.aspx

My problems are:

1.  How do you set the value of the checkbox?  Whe I use the code:

<ASP:TemplateColumn HeaderText="<b>Select</b>">
           <ItemTemplate>
           <ASP:CheckBox id="SelectedMember" value="<%# Container.DataItem
("LastName") %>" runat="server"/>
           </ItemTemplate>
</ASP:TemplateColumn>

id does not allow me to set the value without a compiler error.  How can
it be dynamically set?

2.  How do you reference the checkbox field?  When I tried

Response.Write("The Member List is " & Request.Form("SelectedMember"))

It returned nothing, possibly in part due to not being able to set the
value.  Any help or examples would be greatly appreciated.  Thanks.






  Return to Index