0
我很新的這如此容忍我複選框在Telerik的RadListview
我與RadListView從Telrik工作,並嘗試使用InsertTemplate則內部複選框,但我似乎無法檢索檢查值。首先我注意到,當我嘗試寫入時,intellesense不會識別我的asp:checkbox id,所以我使用FindControl,但是在telerik demo()中看到他們按名稱訪問複選框。無論如何,這是我正在做的。正如你所看到的,我希望評估複選框,並根據是否檢查插入時是否進行檢查。
感謝您的幫助
列表
<telerik:RadListView ID="IslandManagerList" runat="server" ItemPlaceholderID="IslandListContainer"
DataSourceID="dbIslandEditManager" AllowPaging="True" InsertItemPosition="FirstItem" OnNeedDataSource="IslandManagerList_NeedDataSource" DataKeyNames="ItemId">
<LayoutTemplate>
<section style="display: table; margin: 0px auto; width: auto;">
<telerik:RadDataPager ID="IslandManagerListPager" Skin="pj-Pager" EnableEmbeddedSkins="false"
runat="server" PagedControlID="IslandManagerList" PageSize="15">
<Fields>
<telerik:RadDataPagerButtonField FieldType="Prev" />
<telerik:RadDataPagerButtonField FieldType="Numeric" />
<telerik:RadDataPagerButtonField FieldType="Next" />
</Fields>
</telerik:RadDataPager>
</section>
<asp:Button ID="btnInitInsert" class="ui-like-button" runat="server" Text="Add an Island" OnClick="btnInitInsert_Click" />
<section>
<asp:PlaceHolder ID="IslandListContainer" runat="server"></asp:PlaceHolder>
</section>
</LayoutTemplate>
<ItemTemplate>
<section class="listview-item">
<section style="float: left; margin: 10px;">
<div style='width: 150px; height: 93px; background-color: #f7f7f7;'>
<p class="notice" style='position: absolute; z-index: 0; width: 120px; top: 35px;
left: 18px;'>
no image
</p>
<a href="/myislands/viewer?albumid=<%#Eval("ItemId")%>"><%#Eval("AlbumLogoSource")%></a></div>
</section>
<section style="float: left; width: 80%;">
<h3 style="margin: 10px 10px 5px 10px">
<a href="/myislands/viewer?albumid=<%#Eval("ItemId")%>"><%#Eval("Title")%></a> </h3>
<p style="font: 14px/20px tahoma; margin: 0px 10px 0px 10px;">
<%#Eval("Description")%></p>
</section>
<section class="photomanager-command-btns">
<asp:Button ID="editIsland" class="ui-like-button" runat="server" CommandName="Edit" Text="Edit" CausesValidation="false" />
<div class="ui-like-button" style="display:inline-block"><a id="uploadLink" href="/islands/tabid/917/ctl/upload/mid/1762/Default.aspx?aid=<%#Eval("ItemId")%>">Upload</a></div>
<div class="ui-like-button" style="display:inline-block"><a id="shareLink" href="/islanders?island=<%#Eval("ItemId")%>">Connect Friends</a></div>
</section>
</section>
</ItemTemplate>
<EditItemTemplate>
<section class="listview-item">
<section style="float: left; margin: 10px;">
<div style='width: 150px; height: 93px; background-color: #f7f7f7;'>
<p class="notice" style='position: absolute; z-index: 0; width: 120px; top: 35px;
left: 18px;'>
no image
</p>
<a href="/myislands/viewer?albumid=<%#Eval("ItemId")%>"><%#Eval("AlbumLogoSource")%></a></div>
</section>
<section style="position: relative; float: left; font: 14px/20px tahoma;margin: 10px 10px 10px 10px;">
<div style="overflow:hidden">
<div style="width: 75px; float: left; margin: 10px 10px 5px 10px">
title:</div>
<div style="float: left">
<asp:TextBox class="photomanager-edit-field" ID="updateTitle" runat="server" Text='<%# Bind("Title")%>'></asp:TextBox></div>
</div>
<div style="overflow:hidden">
<div style="width: 75px; float: left; margin: 0px 10px 10px 10px;">
about:
</div>
<div style="float: left">
<asp:TextBox class="photomanager-edit-field" ID="updateDescription" TextMode="MultiLine"
Columns="5" Rows="4" runat="server" Text='<%#Bind("Description")%>'></asp:TextBox></div>
</div>
</section>
<div style="position: absolute; bottom: 10px; right: 20px;">
<asp:Button Style="float: left" class="ui-like-button" ID="saveIslandUpdate" runat="server"
CommandName="Update" Text="Save" />
<asp:Button Style="float: left" class="ui-like-button" ID="cancelIslandUpdate" runat="server"
CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</div>
</section>
</EditItemTemplate>
<InsertItemTemplate>
<section class="listview-item">
<section style="position: relative; float: left; font: 14px/20px tahoma; margin: 10px 10px 10px 10px;">
<div style="overflow: hidden">
<div style="width: 125px; float: left; margin: 10px 10px 5px 10px">
<h3>
Island Name:</h3>
</div>
<div style="float: left">
<asp:TextBox class="photomanager-edit-field" ID="tbTitle" runat="server" Text='<%# Bind("Title")%>'></asp:TextBox></div>
<asp:RequiredFieldValidator ID="rvTitle" runat="server" ControlToValidate="tbTitle"
ErrorMessage="Please give your Island a name" Display="Dynamic" />
</div>
<div style="overflow: hidden">
<div style="width: 125px; float: left; margin: 0px 10px 10px 10px;">
<h3>
About:</h3>
</div>
<div style="float: left">
<asp:TextBox class="photomanager-edit-field" ID="tbDescription" TextMode="MultiLine"
Columns="5" Rows="4" runat="server" Text='<%#Bind("Description")%>'></asp:TextBox>
<asp:RequiredFieldValidator ID="rvDescription" runat="server" ControlToValidate="tbDescription"
ErrorMessage="Please enter a little something about your Island" Display="Dynamic" />
</div>
</div>
</section>
<section style="position: relative; float: left; font: 14px/20px tahoma; margin: 10px 10px 10px 10px;">
<asp:CheckBox ID="makeIslandPublic" runat="server" CssClass="ui-like-button tooltip-item"
Checked="false" Text="Make this Island Viewable to the Public" /><div style="display: inline-block;
cursor: pointer;" class="tooltip-item">
<img src="images/icon_help_32px.gif" /></div>
<div class="show-tooltip" style="width: 250px;">
A public Island can be viewed by anyone. Use a public island when you want to show
of your works to the community and gain reputation to compete in fun contests</div>
</section>
<div style="position: absolute; bottom: 10px; right: 20px;">
<asp:Button ID="btnPerformInsert" class="ui-like-button" runat="server" Text="Add"
CommandName="PerformInsert" />
<asp:Button ID="BtnCancel" class="ui-like-button" runat="server" Text="Cancel" CommandName="Cancel"
CausesValidation="false" />
</div>
</section>
</InsertItemTemplate>
</telerik:RadListView>
protected void Page_Load(object sender, System.EventArgs e)
{
IslandManagerGrid.Visible = buttonToggleGridView.Checked;
IslandManagerList.Visible = buttonToggleListView.Checked;
}
protected void IslandManagerGridDataSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@AlbumOwner"].Value = base.UserId;
}
protected void btnInitInsert_Click(object sender, System.EventArgs e)
{
IslandManagerList.ShowInsertItem();
IslandManagerList.FindControl("btnInitInsert").Visible = false;
}
protected void IslandManagerGridDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
CheckBox PublicChecked = (CheckBox)IslandManagerList.FindControl("makeIslandPublic");
var isPublicChecked = PublicChecked.Checked;
if (isPublicChecked == true)
{
e.Command.Parameters["@ViewRoles"].Value = "All Users";
}
else
{
e.Command.Parameters["@ViewRoles"].Value = "Administrators";
}
e.Command.Parameters["@CreatedByUser"].Value = base.UserId;
e.Command.Parameters["@Owner"].Value = base.UserId;
}
#endregion