我有這樣下面的代碼創建一個webpage.I一個GridView我試圖禁用SelectButton或使其不可見,或直接刪除它。我試圖選擇按鈕 - CommandField中的一個GridView在ASP.NET
AutoGenerateSelectButton="false"
和
<asp:CommandField SelectText="Seç" Visible="false"
ShowSelectButton="True" />
我甚至刪除了這部分
<Columns>
<asp:CommandField SelectText="Seç" ShowSelectButton="True" />
</Columns>
他們都不奏效,則SelectButton是ST在那裏生病。 我試圖改變它的SelecText
到Aç
與
<asp:CommandField SelectText="Aç" ShowSelectButton="True" />
這沒有工作的well.I也試過
ShowSelectButton="False" and it didn't change anything.
<asp:UpdatePanel ID="UpdatePanelEnCokSatilanUrunler" runat="server">
<ContentTemplate>
<asp:Panel ID="PanelEnCokSatilanUrunler" runat="server"
GroupingText="En Çok Satılan Ürünler"
BorderWidth="1" Font-Bold="true">
<table class="style1">
<tr>
<td>
<asp:GridView ID="GridView_EnCokSatilanUrunler"
runat="server"
OnRowDataBound="GridView_EnCokSatilanUrunler_RowDataBound"
Font-Bold="false"
OnSelectedIndexChanged="GridView_EnCokSatilanUrunler_SelectedIndexChanged"
AllowSorting="true"
OnSorting="GridView_EnCokSatilanUrunler_Sorting">
<Columns>
<asp:CommandField SelectText="Seç"
ShowSelectButton="True"/>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
這是我在aspx.cs,這不做任何事情與SelectButton
protected void GridView_EnCokSatilanUrunler_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView_EnCokSatilanUrunler_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
((LinkButton)e.Row.Cells[1].Controls[0]).Text = "Ürün No";
((LinkButton)e.Row.Cells[2].Controls[0]).Text = "Ürün Adı";
((LinkButton)e.Row.Cells[3].Controls[0]).Text = "Satış Miktarı";
((LinkButton)e.Row.Cells[4].Controls[0]).Text = "Ürün Durum";
((LinkButton)e.Row.Cells[5].Controls[0]).Text = "Ürün Tipi";
((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Marka";
((LinkButton)e.Row.Cells[7].Controls[0]).Text = "Model";
}
else if (e.Row.RowType == DataControlRowType.DataRow)
{
}
}
protected void GridView_EnCokSatilanUrunler_Sorting(object sender, GridViewSortEventArgs e)
{
if (EnCokSatilanUrunlerSortColumn == e.SortExpression)
{
if (EnCokSatilanUrunlerSortDirection)
EnCokSatilanUrunlerSortDirection = false;
else if (!EnCokSatilanUrunlerSortDirection)
EnCokSatilanUrunlerSortDirection = true;
}
else
EnCokSatilanUrunlerSortDirection = true;
EnCokSatilanUrunlerSortColumn = e.SortExpression;
EnCokSatilanUrunlerPageIndex = 0;
GridView_EnCokSatilanUrunler.SelectedIndex = -1;
}
void EnCokSatilanUrunlerGridDoldur()
{
GridView_EnCokSatilanUrunler.DataSource = DAL.raporx.DAOUrunx.GetEnCokSatilanBesUrun(
DateTime.Now - new TimeSpan(30, 0, 0, 0),
DateTime.Now
);
GridView_EnCokSatilanUrunler.DataBind();
}
我只想要一個GridView
沒有SelectButton
。
建議增加一個模板字段,並把鏈接按鈕,會說「選擇「 – deostroll
@deostroll謝謝Mr.deostroll,但我不希望選擇按鈕甚至不能作爲鏈接按鈕。 – Bastardo