Fetch From Database

how to fetch data from other website in asp.net, i mean the search result is in one website then how to bring that search result to my form ?

You need to use a technique called "screen scraping".  Get the html from the results page using the code here

http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx

You will then need to parse that html to get the data you want.  Depending on how you do this, if the target site changes their html then you will need to re-code your site too.

Pls tel me step by step procedure i cnt understand ? i am new to dotnet and  screen scraping... pls provide more details... and send me the procedure pls...

?

maddyrafi8975

how to fetch data from other website in asp.net, i mean the search result is in one website then how to bring that search result to my form ?

If you are not owning both the websites, then getting search results will not be possible.

Say if there are 2 sites a.com and b.com:

1. If you own both the sites, then use Iframe in your website to display the search result.

2. You can also use http GET & POST method to transact between the two sites.

If you want to get data from a.com into b.com but you only own (manage) b.com, then you cannot get search results. But you can get content from that page by doing html parsing of the page.

Hope this helps

Im not Understanding but May be Im wrong. you want the Search result of another website and you want to display these results on your web form... its Interesting but i didnt do that so far and didnt think.. for it

as the 2nd Post is about Screen Scrapping so try this

http://www.codeproject.com/Articles/1915/Screen-Scraping-with-C-for-ASP-NET

And Rafi you may you Google Search result and Iframe may be this can help.

i want the Search result of another website and you want to display these results on my web form...

i have one form like transport information, in that form i have 3 textbox, in 1st textbox i put trichy in 2nd textbox i put chennai in 3rd textbox enter date and give search means the search want to search in this http://www.ticketgoose.com/ website and give me result in my form gridview how will i do this ? 

 i want the Search result of another website and want to display these results on my web form...

Guide me pls... screen scraping or WCF or iframe ot GET POST method which is i want to use in my this project i am so much confusion pls guide me more... pls...

http://www.ticketgoose.com/bookbustickets/TravelBkgSearchAction.do is sending search queries through session using, i think, java. So it will not be possible to get search result from that page unless you can programmatically fill in the form & subject the search button, get the session query string.

If you still want to try, please try to use browser control of .net, open the page, parse the page info, fill the form, submit, get result & then use screen scraping / html parsing to get the page content.

pls tel me step procedure, now what wil i do ?

open 1 web from and fill the form here its done here, and after how to write that coding in search button ? what i want to write in search button ?

using that link code how will i write code  in which event ? i nthat link have getpost and response ? how to write that code in my page ?

[RESOLVED] validation summary not generating using update panel

Hi ,

I made a form that when submit button is clicked the validation summary is shown on DIALOG BOX but AFTER A POSTBACK. i opened it on clicked event when page.isvalid is false.

now what i want is How i can show dialog box without postback showing summary, i tried to add validationgroup in button but then it wont allow to show dialog box (summary) showing to complete form for that validationgroup to postback

thanks

now i tried to wrap up the button in update panel. but it becomes the worst.

summary is outside from update panel but there is no error messages shown in the validation summary when i wrap the button in update panel when i keep button outside update panel the summary works fine.

How i can use validation summary with update panel

Based on your description above, as far as I know, if you are using validation control, you must postback data you want to be validated to the server side every time. Or you need validate the data on client side by using javascript. You also need to postback the data even if you use the UpdatePanel controls. By using UpdatePanel controls, you can refresh selected parts of the page instead of refreshing the whole page with a postback. This is referred to as performing a partial-page update. You just want to show summary without postback, but the inputs of people are different everytime. So the summary is always changed. If I misunderstand you, I hope you follow up and give me more details.

shan000

Hi ,

I made a form that when submit button is clicked the validation summary is shown on DIALOG BOX but AFTER A POSTBACK. i opened it on clicked event when page.isvalid is false.

now what i want is How i can show dialog box without postback showing summary, i tried to add validationgroup in button but then it wont allow to show dialog box (summary) showing to complete form for that validationgroup to postback

thanks

Works fine from my end, here is what I tried:

<form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="form"/>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
                ErrorMessage="TextBox cannot be empty" ValidationGroup="form" ></asp:RequiredFieldValidator>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger runat="server" ControlID="Button1"/>
            </Triggers>
        </asp:UpdatePanel>
        <asp:Button ID="Button1" runat="server" Text="Invoke Validation" ValidationGroup="form"/>
    </div>
    </form>

Hope this helps

[RESOLVED] Dynamic Update query problem

Plz give some ideas where I m wrong!!!!!!!

set @query1 ='update #temp set ['+@col1+']='+@a+' where id='+@COUNT

exec @query1

showing me error

Msg 214, Level 16, State 3, Procedure sp_executesql, Line 1

Procedure expects parameter '@parameters' of type 'ntext/nchar/nvarchar'.

hi, i hope you should the @query1 variable as nvarchar

E.g: declare @query nvarchar(100)

set @query='select top 1 * from Countries'

exec sp_executesql @query

thank u for fast reply  i got following error

set @query1 ='update #temp set [@col1]=@a where id=@COUNT'

EXEC sp_executesql @query1

 

Msg 137, Level 15, State 2, Line 1

Must declare the scalar variable "@a".

@col1,@a,@COUNT are declare previously and having dynamic values!!!!!

hi, your earlier query itself is rite.

only thing you need to declare the @query1 variable as nvarchar, incase your value variables of type int or anything, you need to convert it as varchar

refer below code

declare @query1 nvarchar(100)
declare @col1 varchar(10)
set @col1='Name'
declare @a varchar(10)
set @a='ABC'
set @query1 ='update #temp set ['+@col1+']='+@a+' where id=' +CAST(@COUNT as varchar)
exec @query1

Mark my both reply as answered one

 

Thnk u Karthik again but,

When I m doing so it gives below error

 

set @query1 ='update #temp set ['+@col1+']='+@a+' where id='+CAST(@COUNT as varchar)

EXEC @query1

Msg 2812, Level 16, State 62, Procedure Test1, Line 64

Could not find stored procedure ''.

sorry.. i have missed sp_executesql

declare @query1 nvarchar(100)  declare @col1 varchar(10) 
set @col1='Name' 
declare
@a varchar(10) 
set @a='ABC' 
set @query1 ='update #temp set ['+@col1+']='+@a+' where id=' +CAST(@COUNT as varchar) 
exec sp_executesql @query1

mark all my replies as answered one

I trying to solve it but again got new error.....

In @col1 the value of date(e.g.12/03/2012) as column name ,@a having value 'A' as string and @COUNT has value of id means 1,2,3

Now problem when I do as u asked the value of @a which is 'A' set as column name and give following error...

Msg 207, Level 16, State 1, Line 1

Invalid column name 'A'.

Its done while changing query from

set @query1 ='update #temp set ['+@col1+']='+@a+' where id='+CAST(@COUNT as varchar)

EXEC sp_executesql @query1

to

set @query1 ='update #temp set ['+@col1+']='''+@a+''' where id='+CAST(@COUNT as varchar)

EXEC sp_executesql @query1