2014年7月13日 星期日

[RESOLVED] Does anyone know why Delete, Edit, and New buttons aren't showing up on my DetailsView?


I am using DetailsView controls to display data.


All I am trying do here is display 3 buttons, Delete,
Edit
, New


When I run the app, none of them is displaying.


Instead, Insert and Cancel buttons are displaying.


As far as I know, Insert or Cancel can only display after clicking on
New link; in my case button


What am I doing wrong?


Many thanks in advance




CellPadding="4" DataKeyNames="RecordID" DataSourceID="SqlDataSource3" ForeColor="#333333"
GridLines="None" Height="50px" Width="100%">






ReadOnly="True" SortExpression="RecordID" />

ShowDeleteButton="true"
DeleteText="Delete Record" ShowEditButton="true"
EditText="Edit Record" ShowInsertButton="true"
InsertText="Insert Record"
NewText="New Record" />








Unless something is setting your dv to be in insert mode. 



Thank you very much for your respone.


When I go into design mode, I see all 3 appear correctly.


Please see attached.


Sorry, I forgot attachment is not allowed here.


 



Hi simflex,


I copy your code in my .aspx and it can display 3 buttons named Delete Record, Edit Record, and Insert Record.


The only difference is the datasource. So you can check your datasource. 


And I share the code in my lab machine:


            CellPadding="4" DataKeyNames="EmployeeID" DataSourceID="SqlDataSource1" ForeColor="#333333"
GridLines="None" Height="50px" Width="100%">






ReadOnly="True" SortExpression="EmployeeID" />

ShowDeleteButton="true"
DeleteText="Delete Record" ShowEditButton="true"
EditText="Edit Record" ShowInsertButton="true"
InsertText="Insert Record"
NewText="New Record" />






Hope it can help.





Thank for the response.


I see the problem and yes, MetalASP.Net is correct. It was put on insert mode:


DetailsView1.ChangeMode(



Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
If DetailsView1.Rows.Count = 0 Then
DetailsView1.ChangeMode(DetailsViewMode.Insert)
End If
End Sub

How do I change that so all 3 will show?


Thanks again


 


Ok, I got it now. When you insert a record, then it automatically activates the delete, edit and New options.


Thank you.



沒有留言:

張貼留言