How do I get rid of the select button in a gridview?


K

Kat

This is my grid and my datasource. I cannot seem to find where the Select
button is coming from, I even tried in the databind event to remove it, but
column 0 apparently is the edit/delete field (
"gvClientStreetAddresses.Columns(0).Visible = False"). Thanks for your
help.


<asp:GridView ID="gvClientStreetAddresses" runat="server"
width="100%" DataSourceID="dsClientStreetAddresses"
AutoGenerateColumns="False"
EmptyDataText="Street Address: No Data Found">
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>


<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label2" visible="false"
runat="server" Text='<%# Bind("ClientStreetAddressID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>


<asp:TemplateField HeaderText="Category"
SortExpression="CategoryID">
<EditItemTemplate>
<asp:DropDownList ID="ddlStreetAddressCategories"
CSSClass="grid" runat="server" DataSourceID="dsStreetAddressCategoriesDDL"
DataTextField="Category"
DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
<asp:ListItem Selected="True"
Value="0">(none)</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<HeaderStyle Font-Bold="True" />
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Category") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="StreetAddress1" HeaderText="Address"
SortExpression="StreetAddress1" />
<asp:BoundField DataField="City" HeaderText="City"
SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State"
SortExpression="State" />
<asp:BoundField DataField="Zip" HeaderText="Zip"
SortExpression="Zip" />
</Columns>
</asp:GridView>
<br /><br />



<asp:SqlDataSource ID="dsClientStreetAddresses" runat="server"
ConnectionString="<%$ myConnectionString %>"
SelectCommand="ClientStreetAddressesSelect"
UpdateCommand="ClientStreetAddressUpdate"
UpdateCommandType="StoredProcedure"
DeleteCommand="ClientStreetAddressDelete"
DeleteCommandType="StoredProcedure"
InsertCommand="ClientStreetAddressInsert"
InsertCommandType="StoredProcedure" SelectCommandType="StoredProcedure">
<UpdateParameters>
<asp:parameter Name="ClientStreetAddressID" Type="String" />
<asp:parameter Name="CategoryID" Type="Int32" />
<asp:parameter Name="CompanyName" Type="String" />
<asp:parameter Name="StreetAddress1" Type="String" />
<asp:parameter Name="StreetAddress2" Type="String" />
<asp:parameter Name="StreetAddress3" Type="String" />
<asp:parameter Name="City" Type="String" />
<asp:parameter Name="State" Type="String" />
<asp:parameter Name="Zip" Type="String" />
<asp:parameter Name="Comments" Type="String" />
</UpdateParameters>
<DeleteParameters>
<asp:parameter Name="id" Type="String" />
</DeleteParameters>
<SelectParameters>
<asp:ControlParameter ControlID="gvClients"
Name="ClientID" PropertyName="SelectedValue" />
</SelectParameters>

<InsertParameters>
<asp:parameter Name="ClientID" Type="String" />
<asp:parameter Name="StreetAddressCategoryID"
Type="Int32" />
<asp:parameter Name="CompanyName" Type="String" />
<asp:parameter Name="StreetAddress1" Type="String" />
<asp:parameter Name="StreetAddress2" Type="String" />
<asp:parameter Name="StreetAddress3" Type="String" />
<asp:parameter Name="City" Type="String" />
<asp:parameter Name="State" Type="String" />
<asp:parameter Name="Zip" Type="String" />
<asp:parameter Name="Comments" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
 
Ad

Advertisements

K

Kat

I found the answer to this. even though I had AutoGenerateSelectButton to
false in the properties, I had to set it in the load event and that worked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top