I have a radlistview which has the datapager enabled...
But when I launch the website it currently loads the first datapage on the listview (i.e the first page of comments). Is there a way to change this so that it opens the last page?
Here is the current radlistview...
<telerik:RadListView ID="RadListViewComments" runat="server" AllowPaging="True" DataKeyNames="ID" DataSourceID="SqlDataSourceComments" PageSize="5">
<LayoutTemplate>
<div class="RadListView RadListViewFloated RadListView_Default">
<div class="rlvFloated rlvAutoScroll">
<div id="itemPlaceholder" runat="server">
</div>
</div>
<telerik:RadDataPager ID="RadDataPager1" runat="server">
<Fields>
<telerik:RadDataPagerButtonField FieldType="Numeric" />
</Fields>
</telerik:RadDataPager>
</div>
<ItemTemplate>
<div class="rlvI" style="width: 700px; margin-bottom: 50px" margin-right: 100%>
<asp:Label ID="ownerLabel" runat="server" Text='<%# Eval("owner") %>' />   -  
<asp:Label ID="dateLabel" runat="server" Text='<%# Eval("commentdate")%>' />
<br />
<asp:Label ID="commentLabel" runat="server" Text='<%# Eval("comment") %>' />
</div>
</ItemTemplate>
<EmptyDataTemplate>
<div class="RadListView RadListView_Default">
<div class="rlvEmpty">
There are no previous comments.</div>
</div>
</EmptyDataTemplate>
</telerik:RadListView>
Thanks
In the code-behind you can fire a command event with the "Last" argument on PageLoad to force it to go to the last page.
See
how change the RadDataPager Page# From CodeBehind (server-side)
http://www.telerik.com/help/aspnet-ajax/datapager-overview.html
Related
I have a GridView through which I am displaying some books details and it can be filtered based on book attributes. The problem is this if I filter some books and try to edit one of them the editor pick the id of overall row value not the new one. var id = Convert.ToInt32(gridview.Rows[e.NewEditIndex].Cells[1].Text); I am getting index value through this
<div class="col">
<asp:GridView OnRowEditing="GridView2_RowEditing" OnRowUpdating="GridView3_RowUpdating" OnRowCancelingEdit="GridView3_RowCancelingEdit"
class="table table-striped table-bordered" ID="GridView3" runat="server" AutoGenerateColumns="false" DataKeyNames="Id"
HeaderStyle-BackColor="#95daa4" HeaderStyle-ForeColor="Black" >
<Columns >
<asp:CommandField ShowEditButton="true" ControlStyle-Width="26px" ControlStyle-CssClass="linkGVE"/>
<asp:BoundField DataField="Id" HeaderText="ID" ReadOnly="True" SortExpression="Id">
<ControlStyle Font-Bold="True" CssClass="linkGVE"/>
<ItemStyle Font-Bold="True"/>
</asp:BoundField>
<asp:TemplateField >
<ItemTemplate>
<div class="container-fluid">
<div class="col-lg-10">
<div class="row">
<div class="col-12">
<asp:Label ID="Label1" runat="server" class="animated bounceInRight" Text='<%# Eval("BookName") %>' Font-Bold="True" Font-Size="18px"></asp:Label>
</div>
</div>
<br/>
<div class="row">
<div class="col-12">
<span>
<b>Province -</b><span> </span>
<asp:Label ID="Label4" runat="server" Text='<%# Eval("Province") %>'></asp:Label>
</span>
</div>
</div>
<div class="row">
<div class="col-12">
<b>Subject - </b>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("Subject") %>'> </b></asp:Label>
| <b>Categories -</b>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("Categorey") %>'></asp:Label>
| <b>PackageName -</b>
<asp:Label ID="Label7" runat="server" Text='<%# Eval("PackageName") %>'></asp:Label>
</div>
</div>
<div class="row">
<div class="col-12">
<b>CategoricalTitle -</b>
<asp:Label ID="Label12" runat="server" Text='<%# Eval("CategoricalTitle") %>'></asp:Label>
</div>
</div>
</div>
<div class="col-lg-2 " style="margin-top: 25px; text-align: center;">
<asp:Image class="img-fluid" BorderWidth="2px" BorderColor="#82aeb1" ID="Image1" Height="100px" Width="120px" runat="server" ImageUrl='<%# "http://0.0.0.0/Pictures/" + Eval("PictureURL") %>'/>
Download
</div>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Try finding control is easier then finding cells because cell is created if you put any container before the control.
You can try FindControl rather than reading the cell as below
how to find control in edit item template?
GridView1.Rows[e.NewEditIndex].FindControl("control");
and cast it accordingly.
Also if it is a primary key put into data keys of gridview and get it from there. Example Get DataKey values in GridView RowCommand
Also hopefully you are properly binding data to gridview.
I did not applied ispostback condition on page reload. as soon as I applied the condition my code begin to work. Thanks
I have a listview control that is bounded by an entity query. The main listview is bounded to the entity called Article. The second listview(nested one) is bounded to an icollection of Article_Comment. I am trying to get the ID of a article so that I can use it in updating the article comment table. Below is what I have so far.
<asp:ListView ID="listComment" runat="server" DataKeyNames="ArticleID" >
<LayoutTemplate>
<div class="row">
<h3>Comments</h3>
<blockquote>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</blockquote>
</div>
</LayoutTemplate>
<ItemSeparatorTemplate>
<hr />
</ItemSeparatorTemplate>
<ItemTemplate>
<h4 class="text-error"><%#Eval("Title")%></h4>
<br />
<h4 class="text-error"><%#Eval("ArticleID")%></h4
<br />
<p><%#Eval("ArticleContent")%> </p>
<asp:ListView ID="list" runat="server" DataSource='<%# Eval("Article_CommentTable")%>'
InsertItemPosition="LastItem" OnItemCommand="list_ItemCommand" OnItemDataBound="list_ItemDataBound"
DataKeyNames="ArticleID" OnItemInserting="list_ItemInserting">
<LayoutTemplate>
<div class="row">
<h3>Comments</h3>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</div>
</LayoutTemplate>
<ItemTemplate>
<p>
Username : <%#Eval("UserName")%>
<br />
Comments : <%#Eval("Comment")%>
<br />
<%--<asp:Label ID="lblID" runat="server" Text='<%# Bind("ArticleID")%>'></asp:Label>--%>
<asp:HiddenField ID="hid" runat="server" Value='<%# Bind("ArticleID")%>' />
</p>
</ItemTemplate>
<InsertItemTemplate>
<div class="row" runat="server">
<asp:TextBox ID="txtUserName" runat="server" CssClass="form-control" />
<br />
<asp:TextBox ID="txtComment" runat="server" CssClass="form-control" />
<FCKeditorV2:FCKeditor ID="editorArticle" runat="server"
BasePath="~/FCKeditor/" Height="200px" Width="400px"
Value="Start typing here" ToolbarStartExpanded="False">
</FCKeditorV2:FCKeditor>
<br />
<asp:Button ID="btnAddComment" runat="server" CssClass="btn btn-info"
CommandName="insert" Text="Join The Discussion" CommandArgument='<%#Eval("ArticleID")%>' />
</div>
</InsertItemTemplate>
</asp:ListView>
</ItemTemplate>
</asp:ListView>
I am trying to access the ArticleID for each row that a button is clicked. How should I do that?
you can get it in ItemCommand event as listComment.DataKeys[dataItem.DisplayIndex].Value
I am getting error when i use fallowing code. i have provide the target control id still error is occur.
Please help
<asp:Repeater ID="repDays" runat="server" OnItemDataBound="repDays_OnItemDataBound">
<ItemTemplate>
<td id="tdDay" runat="server">
<asp:Literal ID="litDay" runat="server" />
</td>
<asp:Panel ID="Panel1" runat="server" BackColor="White" BorderColor="#43AAE4" BorderStyle="Solid"
BorderWidth="2px">
<div style="text-align: right; width: 100%">
Some text in popup
</div>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="modalPopupExtender" runat="server" PopupControlID="Panel1"
TargetControlID="tdDay" DropShadow="true">
</ajaxToolkit:ModalPopupExtender>
</ItemTemplate>
</asp:Repeater>
I'm building a web user control.
Now i need to fire some server side events on web user control.
And also need to stop page refreshing.
Can any one tell me how can i fire server side event on web user control without refreshing hole page.
Edit-1
My control (.ascx)
<%--Control designer start--%>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="position:relative;border:none;" id="divComboContainer" runat="server" >
<%--Hidden fields for datacombo values--%>
<asp:HiddenField ID="Hidden_Value" Value="" runat="server" />
<asp:HiddenField ID="Hidden_SorDir" Value="" runat="server" />
<asp:HiddenField ID="Hidden_RowIndex" Value="" runat="server" />
<asp:HiddenField ID="hfScrollPosition" Value="" runat="server" />
<%--Seleted text display textbox--%>
<asp:TextBox ID="txtDisplay" runat="server" CssClass="tb10" autocomplete="off" ToolTip="Type for search"></asp:TextBox>
<%--Panal and controls for dropdown--%>
<asp:Panel ID="DropPanel" runat="server" CssClass="ContextMenuPanel" Width="1000px"
style="display :none;
visibility: hidden;
border:2px solid #E5E5E5;
padding-bottom:-1px;
margin-top:-28px;
background-color:#83ACF3;
overflow:hidden;
height:auto;
max-height:700px;
max-width:1000px;">
<%--<asp:Button ID="Button1" runat="server" Text="Button" />--%>
<%--Search textbox div--%>
<div class="ddeSerch">
<div style="padding-top:5px;float:left;">
Look-Up
</div>
<asp:TextBox runat="server" ID="txtSearch" autocomplete="off" CssClass="tb10" BackColor="White" Width="50%" MaxLength="150"
onclick="return false;"
style="background: url(GridViewCSSThemes/Images/tia.png) no-repeat top right;background-color:White;padding-right:25px;">
</asp:TextBox>
<div style="padding-top:5px;float:right;cursor:pointer;" runat="server" id="dcmbClose" >
Close
</div>
</div>
<%--Datacombo header--%>
<asp:Table ID="Table1" runat="server" CssClass="header" GridLines="Vertical" Width="100%">
</asp:Table>
<%--Datacombo body(records)--%>
<div id="divGrid" runat="server" style="max-height:615px;width:100%;overflow-X:auto;overflow-Y:auto;">
<asp:GridView ID="gridEdit" GridLines="Vertical" runat="server" Width="100%"
ShowFooter="false" AutoGenerateColumns="false" ShowHeader="false" AllowSorting="true"
Font-Size = "11pt" Font-Names = "Arial" style="color:Black;"
AlternatingRowStyle-BackColor="#CCDDFB"
RowStyle-BackColor="WhiteSmoke"
OnRowCreated="gridEdit_RowCreated" OnRowDataBound="gridEdit_RowDataBound" OnSorting="gridEdit_Sorting">
<HeaderStyle HorizontalAlign="Left" CssClass="header" Font-Bold="false" />
<RowStyle CssClass="rowstyle"/>
<Columns>
</Columns>
</asp:GridView>
</div>
<%--Datacombo footer--%>
<table class="footer" id="tblfooter" runat="server">
<tr>
<td style="text-align:left;">
<asp:TextBox Enabled="false" autocomplete="off" ID="lblOrd" CssClass="footer" runat="server" Width="100%"></asp:TextBox>
</td>
<td style="text-align:right;">
<asp:TextBox Enabled="false" autocomplete="off" ID="lblTot" CssClass="footer" style="text-align:right;" runat="server" Width="100%"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
<ajaxToolkit:DropDownExtender runat="server" ID="DDE"
TargetControlID="txtDisplay"
DropDownControlID="DropPanel" HighlightBorderColor="Transparent">
</ajaxToolkit:DropDownExtender>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Use on aspx page
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<uc1:UCDataCombo runat="server" ID="UCDataCombo4"/>
</ContentTemplate>
</asp:UpdatePanel>
When user clicks on header of gridview it fires some events.
And hole page got refreshed.
I need to stop refreshing of hole page.
UpdatePanel enables sections of a page to be partially rendered without a postback.
You can have a full understanding by reading here.
-EDIT-
I don't if this will help but you gotta try this:
Check if is set in your web.config, if it is there you may want to remove it.
Go to this link for more details.
Hope it helps!
Problem i solved by setting clientIDMode to Static.
clientIDMode="Static".
Now update panel works fine.
I'm using VS2010, C#, ASP.NET, I've inserted Ajax Control Toolkit Tab Container which works great, but when I insert a modal popup extender on another panel, tabs do not display! what is going wrong here? How can I have both on them as both are really cool effects
thanks
my tab container:
<cc1:TabContainer runat="server" ID="Tabs" CssClass="visoft__tab_xpie7"
ActiveTabIndex="2" Width="100%" Height="160px">
<cc1:TabPanel runat="server" ID="tab1" HeaderText="برنامه نویسی وب و اتوماسیون">
<HeaderTemplate>
<div >
<asp:Image ID="Image12" BorderStyle="None" runat="server" ImageUrl="~/Images/internet.png" /><br />
وب و اتوماسیون
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab1" style="direction:rtl;">
</div>
</ContentTemplate>
<cc1:TabPanel runat="server" ID="tab2" HeaderText="تله متری" >
<HeaderTemplate>
<div >
<asp:Image ID="Image11" BorderStyle="None" runat="server" ImageUrl="~/Images/telemetry.png" /><br />
تله متری
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab2" style="direction:rtl;">
</div>
<cc1:TabPanel runat="server" ID="tab3" HeaderText="">
<HeaderTemplate>
<div >
<asp:Image ID="Image10" BorderStyle="None" runat="server" ImageUrl="~/Images/mb.png" /><br />
موبایل، گرافیک، بازی
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab3" style="direction:rtl;">
</div>
</ContentTemplate>
<cc1:TabPanel runat="server" ID="TabPanel1" HeaderText="">
<HeaderTemplate>
<div >
<asp:Image ID="Image13" BorderStyle="None" runat="server" ImageUrl="~/Images/flash.png" /><br />
انیمیشن و فلش
</div>
</HeaderTemplate>
<ContentTemplate>
<div runat="server" id="divTab4" style="direction:rtl;">
</div>
</ContentTemplate>
my modal popup extender:
<asp:Panel ID="pnlNews1" runat="server" CssClass="modalPopup" >
<div style="height:100% ; overflow:auto; width: 100%; top:0px; bottom:0px">
<asp:Table ID="Table10" Height="32px" Width="100%" runat="server">
<asp:TableRow HorizontalAlign="Left">
<asp:TableCell>
<asp:ImageButton ID="btnClose1" ToolTip="بستن کادر" runat="server" ImageUrl="~/Images/close.png" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow HorizontalAlign="Right">
<asp:TableCell>
<asp:Label ID="lblTitle1" runat="server" Font-Names="Tahoma" Text="Label"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<div runat="server" id="divBody1">
</div>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
I don't know if this helps, but I had a very similar problem. I had some tabs working, then added a modalpopup extender and a panel, and suddendly my tabs dissappeared.
In my case, my modal popup panel's Visible property was set to "False" (which is not really necessary). Like this:
<asp:Panel ID="ModalPopupPanel" runat="server" CssClass="ModalPopupPanel" Visible="False">
When I deleted this property, the Tabs appeared. So it looks now like this:
<asp:Panel ID="ModalPopupPanel" runat="server" CssClass="ModalPopupPanel">
I know you are not setting this property, but maybe you can try something like this to find what is causing the problem?
Sorry I cannot be of any more help.