|
I tried that too. it returns 10 record and there is no page 2 or 3
below is the query
SELECT *
FROM
(SELECT *,
ROW_NUMBER() OVER(ORDER BY adid) as RowNum
FROM advert e
) as DerivedTableName
WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1
|
|
|
|
|
There are a lot of articles that cover datalist paging, like this one[^] or this one[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi again, this article http://aspalliance.com/157_Paging_in_DataList was someway useful but I have already done that part and it mentions the disadvantage at the end of the article too..
so I changed my database call to add extra parameter i.e. currentindex and total rec to display per page
<pre>
public void AdList(Navigation navigation)
{
List<Advert> adverts = new List<Advert>();
PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
//Based on navigation manage the NowViewing
switch (navigation)
{
case Navigation.Next: //Increment NowViewing by 1
NowViewing++;
break;
case Navigation.Previous: //Decrement NowViewing by 1
NowViewing--;
break;
case Navigation.Last: //Make NowViewing to last page for PagedDataSource
NowViewing = pds.PageCount - 1;
break;
default: //Default NowViewing set to 0
NowViewing = 0;
break;
}
adverts = myBLL.GetAdverts(country, city, adtype,NowViewing,pds.PageSize);
PropertyListCount = adverts.Count;
pds.DataSource = adverts;
pds.PageSize = 10;
//Set the current page index
pds.CurrentPageIndex = NowViewing;
// Disable Prev, Next, First, Last buttons if necessary
lbtnPrev.Enabled = !pds.IsFirstPage;
lbtnNext.Enabled = !pds.IsLastPage;
lbtnFirst.Enabled = !pds.IsFirstPage;
lbtnLast.Enabled = !pds.IsLastPage;
dlPropertyList.DataSource = pds;
dlPropertyList.DataBind();
}
//DataList Pagination Scripts
protected void lbtnPrev_Click(object sender, EventArgs e)
{
PropertyList(Navigation.Previous);
}
protected void lbtnNext_Click(object sender, EventArgs e)
{
PropertyList(Navigation.Next);
}
protected void lbtnFirst_Click(object sender, EventArgs e)
{
PropertyList(Navigation.First);
}
protected void lbtnLast_Click(object sender, EventArgs e)
{
PropertyList(Navigation.Last);
}
public enum Navigation
{
None,
First,
Next,
Previous,
Last,
Pager
}
public int NowViewing
{
get
{
object obj = ViewState["_NowViewing"];
if (obj == null)
return 0;
else
return (int)obj;
}
set
{
this.ViewState["_NowViewing"] = value;
}
}
---STORED proc script
select ROW_NUMBER() OVER(ORDER BY adid) as RowNum,
* from advert where isActive=1 and
c.countryname like '%'+@CountryName+'%' and
a.adcity like '%'+@AdCity+'%' and
a.AdSubCatType like '%'+@AdSubCatType+'%'
) as DerivedTableName
WHERE RowNum BETWEEN @CurrentPageIndex AND (@CurrentPageIndex + @PageSize) - 1
order by adDate desc
</pre>
but this gives only 10 records in one call so how can i display total records, next and previous etc?
|
|
|
|
|
can someone please help me. I need a fastest way to display datalist with hugh record set in website.
|
|
|
|
|
You might try MultiThreading here. Each thread would pull 'n' number of record set from database. Hence if you are having 2 thread for pulling data from database your performance is doubled. Currently if 35000 record is fetched in 5 seconds, then if you use 2 thread for data pulling then you could get 70000 records pulled from database in same 5 seconds.
But the risk is that correct multithreading can provide you very enhanced reformance, whereas if not implemented correctly it can lead to severely affecting the exising system.
Thanks,
Arindam D Tewary
|
|
|
|
|
I am sure there must be an alternative solutions other than multi-threading. I saw this article http://www.netomatix.com/Development/DataListPaging.aspx in this article it users query string but how can i use it without having to use querystring
could someone please help? I now have created two stored proc one returns the total count of the result which is about 35000 and the one to display for a page currently being views i.e.
adverts = myBLL.GetAdverts(country, city, adtype,NowViewing,pds.PageSize);
-SQL
SELECT *
FROM
(
select ROW_NUMBER() OVER(ORDER BY adid) as RowNum,
a.*
from advert
where isActive=1 and
c.countryname like '%'+@CountryName+'%' and
a.adcity like '%'+@AdCity+'%' and
a.AdSubCatType like '%'+@AdSubCatType+'%'
) as DerivedTableName
WHERE RowNum BETWEEN @CurrentPageIndex AND (@CurrentPageIndex + @PageSize) - 1
order by adDate desc
|
|
|
|
|
hey. am new in asp.net. Actually, I have a series of component and would like these component come invisible before.although I invisible the properties, I need to make them invisible before loading page. I am lloking for sth like page load but don't know when and where to write it.
thx for ur help in advance
|
|
|
|
|
Your post isn't exactly clear. If you set the visibility property of the control it will be not be visible when the page loads.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have an ASP page, and want to have a hover changing style event.
Here is the code for the hyperlink.
<asp:HyperLink ID="HyperLink1" runat="server" BorderStyle="None"
Font-Underline="False" NavigateUrl="~/Default.aspx"
ToolTip="See Overview of Cardington Site">
Cardington</asp:HyperLink>
I was thinking there is a way of doing a StaticHoverStyle, but I think I can only do that in a MENU item.
Is there a way of doing a mouse over change easily?
PS Using VB as code behind.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
modified on Monday, March 22, 2010 7:28 PM
|
|
|
|
|
Just add the events to the link
<asp:HyperLink ID="HyperLink1" runat="server" BorderStyle="None"
Font-Underline="False" NavigateUrl="~/Default.aspx"
ToolTip="See Overview of Cardington Site"
onmouseover=MouseOverFunction onmouseout=MouseOutFunction>
Cardington</asp:HyperLink >
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
<asp:HyperLink ID="HyperLink1" runat="server" BorderStyle="None"
Font-Underline="False" NavigateUrl="~/Default.aspx"
ToolTip="See Overview of Cardington Site"
onmouseover = bgcolor="Red" onmouseout = bgColor="Aqua">
Cardington</asp:HyperLink>
I put this line in but it is not a happy bunny.
It is suggesting that if this statement contains quotes, then they must match, but they do.
When I build it fails
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The tag contains duplicate 'bgColor' attributes.
Source Error:
Line 95: <td bgcolor="Aqua" class="style15" style="border-color: #00FFFF" width="88">
Line 96:
Line 97: <asp:HyperLink ID="HyperLink1" runat="server" BorderStyle="None"
Line 98: Font-Underline="False" NavigateUrl="~/Default.aspx"
Line 99: ToolTip="See Overview of Cardington Site"
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Of course its not happy, that is not the correct syntax.
onmouseover="this.style.bgcolor='Red'" onmouseout="this.style.bgcolor='Aqua'"
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yeah, see below!
I beat you to it
I forgot I was in ASP.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Ah, got it!
onmouseover="this.style.color='red'" onmouseout="this.style.color='black'"
Your answer was superb, it got me thinking, got me searching and the final solution was down to me working on your response!
I feel all clever with myself, as I am not an ASP expert!
(obviously).
Thanks, have a vote-up.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Good although if all you are doing is setting styles a better way to handle this would be to use CSS
<style>
.MouseOver:hover
{
color:Red;
}
.MouseOver
{
color: Black;
}
</style>
<asp:HyperLink ID="HyperLink1" runat="server" BorderStyle="None"
Font-Underline="False" NavigateUrl="~/Default.aspx"
ToolTip="See Overview of Cardington Site" CssClass="MouseOver">
Cardington</asp:HyperLink>
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Cheers, I find the more I do, the more I find out what I don't know, and the more I have to ask.
I am getting such an education on this site.
And BTW, thanks for the swift replies.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
I am working on an application using ASP.Net 1.0. I have a crystal report and I want to export that crystal report to MS Excel 2007....I can export to MS Excel 2003 but I am having some problem while Exporting crystal report to MS Excel 2007..Please anyone can help....looking forward...
Thanks.
|
|
|
|
|
http://www.beansoftware.com/ASP.NET-Tutorials/Set-Up-IIS-ASP.NET.aspx[^]
i have followed this link to publish my web but when i am trying to test my application following error occurs on my browser
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Source Error:
Line 33: during development.
Line 34: -->
Line 35: <authentication mode="Windows">
Line 36: <forms loginUrl="Default.aspx" />
Line 37: </authentication>
Source File: d:\inetpub\wwwroot\myapp\web.config Line: 35
|
|
|
|
|
Could you link to screenshots of your application's setup within IIS please?
|
|
|
|
|
Try opening IIS. Expand the Treeview that contains all sites/sub directories etc. Look for the virtual directory called "myapp" (or whatever you've named your site). Right click ->Properties. Under the Directory tab, click the button that says "Create" (which is inside the Application Settings group) then click OK.
Hope that helps...
|
|
|
|
|
Hi experts
I have googled for tips/solutions and failed to get a right method to implement following scenario.
I have a gridview populated with data on page load from my source table.
To make it precise I have fields Ac_Id, Ac_Name, Balance, and user_Id in my table. The user_Id and Ac_Id forms the composite key.
I have say 3 rows in my table as follows
1, Cash, 1000, ABC
2. CITI, 8000, ABC
3. BOA , 6000, ABC
While editing in grid I want let user edit only the balance field if Ac_Name is Cash otherwise User can Edit both Ac_Name and Balance.
whle I could make both ac_name and Balance field editable but failed to achive above. Advise is solicited
Thanks in advance and regards
Kris
|
|
|
|
|
make Template fields in grid view. while editing give text box for that fields and according to your secnerio make the textbox read only.
|
|
|
|
|
Dear Mr.Padmanabhan
Thanks for tip and has worked for me
kris
|
|
|
|
|
In gridView RowDataBound event, disable the editor when type is Cash.
|
|
|
|
|
Hello!
When I try to built my web project I get the following error: "A namespace does not directly contain members such as fields or methods" for a file called 'DownloadFiles.aspx' (which has also an code behind file). The error should be in lone 1 row 1.
<%@Page Language="C#" AutoEventWireup="true" CodeFile="DownloadFiles.aspx.cs"
Inherits="MD.TPConfigurator.Web.DownloadFiles"
Culture="auto" UICulture="auto" Async="true" %>
<html>
<head>
<title>Download</title>
</head>
<body>
</body>
</html>
The funny thing is, when I open the file 'DownloadFiles.aspx' and try to build it again, there is no error any more. I am also sure that there are no members directly in the namespace.
Has anyone any ideas?
Thanks in advance,
Florian
|
|
|
|