Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Datagrid - SORTING, EDITING


Message #1 by "McCloy, Russell" <Russell.McCloy@B...> on Wed, 13 Mar 2002 13:20:41 +1100
Hello all,

 

I have a funny problem.

 

I have created a page with a datagrid. Originally I had bound columns in

this datagrid

as I was not using sort headers. 

I may be wrong but to allow sorting you must have autogeneratecolumns set to

TRUE???

 

Ok. So I have sorting working but when I click on my Edit column to update a

record it

appears to go into edit mode but no text boxes appear.(ie..every field is

READONLY).

I was able to edit before I changed from Bound columns to

autogeneratecolumns=true.

 

I have placed stops in my code to try and see where it is failing but I get

no errors.

 

below is my MyDataGrid_Edit sub.

if I click on record, say, 5 in my datagrid then the value of

myDataGrid.EditItemIndex changes to 4 (index base is zero)

This is correct. I just cant figure out what else to look at. Do I need to

set something to readonly=false.

I cant find this property on any on my datagrid elements.

 

==================================



Sub MyDataGrid_Edit(ByVal obj As Object, ByVal e As

DataGridCommandEventArgs)



myDataGrid.EditItemIndex = e.Item.ItemIndex



BindData()



End Sub



=================================



hope someone can help.



thanks



RuSs





-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...]

Sent: Wednesday, 13 March 2002 5:28 AM

To: ASP+

Subject: [aspx] Applying Stylesheet characteristics to a datagrid





Hello everyone and thanks for your help in advance.  I have an application 

that has a stylesheet called "MyStyleSheet.css".  Witht eh stylesheet is 

an element called "NavBar" that has certain font characteristics.  I have 

developed a control called NavBar.ascx that queries a database and builds 

the navigation bar in the form of a datagrid based on the returned 

dataset.  I want to be able to format the datagrid based on the NavBar 

element of the stylesheet, but can't seem to get it to work.  I tried:



TableItemStyle="NavBar"



But that didn't work.  Any help would be greatly appreciated.  Thanks.




Message #2 by "Klaus Hellmich" <Klaus@H...> on Wed, 13 Mar 2002 08:14:56
Hi RuSs,



My sorting works without autogeneration, for sorting take care about 

SortExpression=...



I also did not have a TextBox in edit-mode when I filled any "<span .../> 

into the Cell, even when it was in ItemTemplate. Maybe there must be plain 

text. Did you introduce any TextBox with an ID, otherwise maybe you 

(or .Net) cannot access it? This is my working example:



	<asp:TemplateColumn>

		<HeaderTemplate>

			Title (Drag&Drop in IE 6.0)

		</HeaderTemplate>

		<ItemTemplate></ItemTemplate>

		<EditItemTemplate>

			<asp:TextBox id="txtboxTitle" Text="Hallo" 

Runat="server"></asp:TextBox>

		</EditItemTemplate>

	</asp:TemplateColumn>



I fill it (and replace "Hallo") at OnItemDataBound()







> Hello all,

>  

> I have a funny problem.

>  

> I have created a page with a datagrid. Originally I had bound columns in

> this datagrid

> as I was not using sort headers. 

> I may be wrong but to allow sorting you must have autogeneratecolumns 

set to

> TRUE???

>  

> Ok. So I have sorting working but when I click on my Edit column to 

update a

> record it

> appears to go into edit mode but no text boxes appear.(ie..every field is

> READONLY).

> I was able to edit before I changed from Bound columns to

> autogeneratecolumns=true.

>  

> I have placed stops in my code to try and see where it is failing but I 

get

> no errors.

>  

> below is my MyDataGrid_Edit sub.

> if I click on record, say, 5 in my datagrid then the value of

> myDataGrid.EditItemIndex changes to 4 (index base is zero)

> This is correct. I just cant figure out what else to look at. Do I need 

to

> set something to readonly=false.

> I cant find this property on any on my datagrid elements.

>  

> ==================================

> 

> Sub MyDataGrid_Edit(ByVal obj As Object, ByVal e As

> DataGridCommandEventArgs)

> 

> myDataGrid.EditItemIndex = e.Item.ItemIndex

> 

> BindData()

> 

> End Sub

> 

> =================================

> 

> hope someone can help.

> 

> thanks

> 

> RuSs

> 

> 

> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: Wednesday, 13 March 2002 5:28 AM

> To: ASP+

> Subject: [aspx] Applying Stylesheet characteristics to a datagrid

> 

> 

> Hello everyone and thanks for your help in advance.  I have an 

application 

> that has a stylesheet called "MyStyleSheet.css".  Witht eh stylesheet is 

> an element called "NavBar" that has certain font characteristics.  I 

have 

> developed a control called NavBar.ascx that queries a database and 

builds 

> the navigation bar in the form of a datagrid based on the returned 

> dataset.  I want to be able to format the datagrid based on the NavBar 

> element of the stylesheet, but can't seem to get it to work.  I tried:

> 

> TableItemStyle="NavBar"

> 

> But that didn't work.  Any help would be greatly appreciated.  Thanks.





  Return to Index