5 Replies - 537 Views - Last Post: 16 February 2013 - 04:33 AM Rate Topic: -----

#1 HeaveNDenieD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-October 11

local search engine

Posted 11 February 2013 - 08:19 PM

good day guys, i would like to write a certain program that will help me search files in a database. I do not know what is the name of the container where the output should be placed. Is it richtextbox? I want it to be like a normal search engine like google but instead it will display all of files that have the same keywords. thanks
Is This A Good Question/Topic? 0
  • +

Replies To: local search engine

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9492
  • View blog
  • Posts: 35,826
  • Joined: 12-June 08

Re: local search engine

Posted 11 February 2013 - 11:11 PM

Quote

I do not know what is the name of the container where the output should be placed.

I am a big fan of data grids.
Was This Post Helpful? 0
  • +
  • -

#3 HeaveNDenieD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-October 11

Re: local search engine

Posted 12 February 2013 - 09:38 PM

View Postmodi123_1, on 11 February 2013 - 11:11 PM, said:

Quote

I do not know what is the name of the container where the output should be placed.

I am a big fan of data grids.


are there any limits for data grids? like they can't hold any image. or how about if the data is too many? will it automatically be on page 2?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9492
  • View blog
  • Posts: 35,826
  • Joined: 12-June 08

Re: local search engine

Posted 12 February 2013 - 09:47 PM

Quote

are there any limits for data grids?

There are limits to everything. You should read up on them at MSDN.

Quote

like they can't hold any image.

Yes they can hold images.

Quote

or how about if the data is too many?

Again, yes, there are limits to the machine and the collection.

Quote

will it automatically be on page 2?

You can easily write up a paging function if you are concerned.
Was This Post Helpful? 0
  • +
  • -

#5 tycos  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 53
  • Joined: 12-February 13

Re: local search engine

Posted 13 February 2013 - 06:09 PM

Simple example of a Datalist with paging:

This is the Datalist that displays some news items, it has some buttons under it to navigate through pages:

<asp:DataList ID="Rep_news" runat="server" CssClass="NewsTable" Width="100%">
                <ItemTemplate>
                    <hr />
                    <h2>
                        <%#DataBinder.Eval(Container.DataItem, "Headline")%>
                        <div class="date_card">
                            <span class="month">
                                <%# App.format_date(Container.DataItem("dateposted"), "month")%>
                            </span><span class="day">
                                <%# App.format_date(Container.DataItem("dateposted"), "day")%>
                            </span><span class="year">
                                <%# App.format_date(Container.DataItem("dateposted"), "year")%>
                            </span>
                        </div>
                    </h2>
                    <div class="clearboth">
                    </div>
                    <p>
                        <%# Container.DataItem("content")%>
                    </p>
                </ItemTemplate>
            </asp:DataList>

 <asp:LinkButton ID="btnPrev" onclick="btnPrev_Click" runat="server" Text="< PREVIOUS" CssClass="button" Width="104px"></asp:LinkButton>
                <asp:LinkButton ID="btnNext" onclick="btnNext_Click" runat="server" Text="NEXT >" CssClass="button" Width="104px"></asp:LinkButton>



Set your paged Data source, I am returning a DataView in the example
pagedData.DataSource = your_sql_lookup(find files by params) as dataview

Set how many items to view per page
pagedData.PageSize = 3

get page number from url, put in a try catch so if its blank will be set to 0

Clicking the buttons reloads the page and adds and minus 1 from the current page

  Dim pagedData As New PagedDataSource 'Used to page news

  Sub loadnews()
        Try
            pagedData.DataSource = App.news("dataview", "news")

            Try
                pagedData.CurrentPageIndex = Int32.Parse(Request.QueryString("Page")).ToString()
            Catch ex As Exception
                pagedData.CurrentPageIndex = 0
            End Try

            pagedData.AllowPaging = True
            pagedData.PageSize = 3

            btnPrev.Enabled = (Not pagedData.IsFirstPage)
            btnNext.Enabled = (Not pagedData.IsLastPage)
            pageNumber.Text = "Page " & (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount
            Rep_news.DataSource = pagedData
            Rep_news.DataBind()
        Catch ex As Exception

        End Try
    End Sub

    Protected Sub btnPrev_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrev.Click
        'Go to previous News page
        Response.Redirect("news.aspx?Page=" & (pagedData.CurrentPageIndex - 1))
    End Sub

    Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
        'Go to next News page
        Response.Redirect("news.aspx?Page=" & (pagedData.CurrentPageIndex + 1))
    End Sub


Was This Post Helpful? 0
  • +
  • -

#6 HeaveNDenieD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-October 11

Re: local search engine

Posted 16 February 2013 - 04:33 AM

by the way i am using form.vb a simple app not a web page :))
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1