gpt4 book ai didi

c# - 我通过下拉列表检查 ListView 的值,但我有空白

转载 作者:行者123 更新时间:2023-11-30 12:54:25 26 4
gpt4 key购买 nike

抱歉我输入了代码,但我不知道如何输入。 enter image description here我有一个由下拉列表填充的 ListView ,并根据它向我显示一些数据的选项,但空白区域保留用于我不使用的信息

下拉列表和 ListView 都链接到两个 sqldatasources下拉列表:

        <div>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="DenominazioneTipo"
DataValueField="IdTipo" AutoPostBack="true">
</asp:DropDownList>
</div>

ListView :

 <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource2" 
DataKeyNames="ID" InsertItemPosition="LastItem">
<EmptyDataTemplate>
<table runat="server" style="background-color: #FFFFFF;
border-collapse: collapse; border-color:
#999999; border-style: none; border-width: 1px;">
<tr>
<td>Non è stato restituito alcun dato.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server"
CommandName="Insert" Text="Inserisci" OnClick="InsertButton_Click"
Width="140px" />
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #FFFBD6; color: #333333;">
<td>
<asp:Button ID="DeleteButton" runat="server"
CommandName="Delete"
Text="Elimina" OnClientClick="return confirm
('Confermi la cancellazione del record?');" />
<asp:Button ID="EditButton" runat="server"
CommandName="Edit" Text="Modifica" ID_Persona='<%#
Eval("ID") %>' OnClick="EditButton_Click" />
</td>

<td>
<asp:Label ID="NomeLabel" runat="server" Text='<%#
Eval("Nome") %>' />
</td>
<td>
<asp:Label ID="CognomeLabel" runat="server" Text='<%# Eval("Cognome") %>' />
</td>
<td>
<asp:Label ID="CodiceFiscaleLabel" runat="server" Text='<%# Eval("CodiceFiscale") %>' />
</td>
<td>
<asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
</td>
<td>
<asp:Label ID="RagioneSocialeLabel" runat="server" Text='<%# Eval("RagioneSociale") %>' />
</td>
<td>
<asp:Label ID="PivaLabel" runat="server" Text='<%# Eval("Piva") %>' />
</td>
</tr>
</ItemTemplate>



<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">

<table id="itemPlaceholderContainer" runat="server" border="1"
style="background-color: #FFFFFF;
border-collapse: collapse; border-color: #999999;
border-style: none; border-width: 1px;
<tr runat="server" style="background-color: #FFFBD6; color:#333333;">
<th runat="server"></th>
<th runat="server">Nome</th>
<th runat="server">Cognome</th>
<th runat="server">CodiceFiscale</th>
<th runat="server">Email</th>
<th runat="server">RagioneSociale</th>
<th runat="server">Piva</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:dbConnection %>" SelectCommand="SELECT [Nome], [Cognome], [Email], [CodiceFiscale], [RagioneSociale], [Piva], [ID] FROM [Persona] WHERE ([Tipocliente] = @Tipocliente)" DeleteCommand="DELETE FROM [Persona] WHERE [ID] = @original_ID" InsertCommand="INSERT INTO [Persona] ([Nome], [Cognome], [Email], [CodiceFiscale], [RagioneSociale], [Piva]) VALUES (@Nome, @Cognome, @Email, @CodiceFiscale, @RagioneSociale, @Piva)" OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [Persona] SET [Nome] = @Nome, [Cognome] = @Cognome, [Email] = @Email, [CodiceFiscale] = @CodiceFiscale, [RagioneSociale] = @RagioneSociale, [Piva] = @Piva WHERE [ID] = @original_ID">
<DeleteParameters>
<asp:Parameter Name="original_ID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Nome" Type="String" />
<asp:Parameter Name="Cognome" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="CodiceFiscale" Type="String" />
<asp:Parameter Name="RagioneSociale" Type="String" />
<asp:Parameter Name="Piva" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="Tipocliente" PropertyName="SelectedValue" Type="Int32" DefaultValue="1" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Nome" Type="String" />
<asp:Parameter Name="Cognome" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="CodiceFiscale" Type="String" />
<asp:Parameter Name="RagioneSociale" Type="String" />
<asp:Parameter Name="Piva" Type="String" />
<asp:Parameter Name="original_ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>

预先感谢您的合作

最佳答案

**I'm getting error while adding this sample code in comment. So I putting it in answer filed. In code behind file add code just like Please find appropriate event to do that **

if(NomeLable.text !=null)
{
NomeLable.visible = true ;
}
else
{
NomeLable.visible = false;
}

关于c# - 我通过下拉列表检查 ListView 的值,但我有空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56680760/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com