Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Datagrid with edit checkboxes


Message #1 by lgy@n... on Fri, 2 Aug 2002 07:52:13
Thanks once again for your input, I wasn't aware of the issue with 
netscape, but it's not that big issue for mw since it's an IntraNet app. 
that im working on.

I have tested a bit futher and I recieve a Runtime Error in the 
Javascript generated by ASP.NET when I click the Edit-link

	function __doPostBack(eventTarget, eventArgument) {
		var theform =3D document.NewAnalysis;
		theform.__EVENTTARGET.value =3D eventTarget;
		theform.__EVENTARGUMENT.value =3D eventArgument;
		theform.submit(); //This is
	}
Any surgestions

regards,

Lars


-----Original Message-----
From: Montgomery, Aiden (External)
[mailto:Aiden.Montgomery@f...]
Sent: 2. august 2002 10:39
To: ASPX_Professional
Subject: [aspx_professional] RE: Datagrid with edit checkboxes


Hello,

I am not sure why your Edit command is not working as you have not 
provided your event handling code.

However if you want your users to only edit the check box then set all 
of your other columns with

		ReadOnly=3D"True"

This will prevent them from being edited.

One other thing that you might not be aware of is that using the

		<asp:checkbox id=3Dchk runat=3D"server" Enabled=3D"False">

May not work in Netscape.  I have found that .NET applies the 
Enabled=3D"False" to a <SPAN> tag around the Checkbox.
This does not seem to be a standard setting in the <SPAN> tag and 
therefore Netscape ignores it.

HTH,

Aiden Montgomery

-----Original Message-----
From: lgy@n... [mailto:lgy@n...]
Sent: 02 August 2002 08:52
To: ASPX_Professional
Subject: [aspx_professional] Datagrid with edit checkboxes


I have a datagrid with normally bounded columns and a templateColumn 
were I
populate a checkbox from a bit field by eval()-method.

My problem is that i want to let the user edit only the column with
checkboxes, but first the have to choose edit from a edit-column.

I have made the Edit, Update and Cancel-command, but the Edit-command
doesn't seems to work, som I haven't tested the two other commands.

Regards Lars


My datagrid looks as follows:

<asp:DataGrid id=3DdgAnalysis runat=3D"server" 
AutoGenerateColumns=3D"False"
DataMember=3D"getAnalysisInfo" DataKeyField=3D"Analysis_ID" 
DataSource=3D"<%#
dsAnalysis %>" OnCancelCommand=3D"dgAnalysis_CancelCommand"
OnEditCommand=3D"dgAnalysis_EditCommand"
OnUpdateCommand=3D"dgAnalysis_UpdateCommand">
              <Columns>
                <asp:EditCommandColumn ButtonType=3D"LinkButton"
UpdateText=3D"Update" CancelText=3D"Cancel"
EditText=3D"Edit"></asp:EditCommandColumn>
                <asp:BoundColumn DataField=3D"Analysis_Name"
SortExpression=3D"Analysis_Name"
HeaderText=3D"Analysis_Name"></asp:BoundColumn>
                <asp:BoundColumn DataField=3D"Unit" 
SortExpression=3D"Unit"
HeaderText=3D"Unit"></asp:BoundColumn>
                <asp:TemplateColumn HeaderText=3D"Active">
                  <ItemTemplate>
                    <asp:checkbox id=3Dchk runat=3D"server" 
Checked=3D'<%#
DataBinder.Eval(Container.DataItem, "Active") %>' Enabled=3D"False">
                    </asp:checkbox>
                  </ItemTemplate>
                  <EditItemTemplate>
                    <asp:CheckBox id=3Dchkedit Checked=3D'<%#
DataBinder.Eval(Container.DataItem, "Active") %>' Enabled=3D"True"
Runat=3D"server">
                    </asp:CheckBox>
                  </EditItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField=3D"FileName"
SortExpression=3D"FileName" HeaderText=3D"FileName"></asp:BoundColumn>
              </Columns>
              <PagerStyle HorizontalAlign=3D"Center" ForeColor=3D"Black"
BackColor=3D"#999999" Mode=3D"NumericPages"></PagerStyle>
       </asp:DataGrid>




  Return to Index