their is not a insert problem, once you click on send button your page will again reload so you have to control it by ajax update panel it will update only u r area where u r message is getting inserted one more thing in send button click event you can
check where end of event u bind data to grid view.
Sachin Patil
+91-7798805999
Marked as answer by mclazarini on May 04, 2012 08:19 PM
I have an input text field which the user can insert an image address. So, I nedd to record it into the database and show it in the same page without reload. If the user insert another image the second one need to be showed with the first and so on.
Recording in database is Ok but I just don´t know where to find an app in Ajax (never worked with ) that I can customize or a function or helper in Web Matrix which could help me.
The sample I provided shows how to do something similar. You need to spend a bit of time understanding how AJAX works properly. There are thousands of articles around that explain the basics. Once you understand those, what you want to do is pretty simple.
For now, I´m using a JavaScript code which I can refresh all page and keep the user querys, but ASAP I´ll study it more and then I´ll post the solution here.
mclazarini
Member
63 Points
57 Posts
Refresh Page
May 04, 2012 01:17 AM|LINK
Hi!
I´m using a Dialog Box in my Web MAtrix Site that contains a text field which the user can insert whatever he wants to be recorded in the database.
So far so good, I have wrote the code correctly.
The problem is when he press the "send" button I don´t know how to get this new data. I have two options:
a-) Refreshing the page after recording;
b-) Geting the data and inserting without refreshing it - (the best option).
Any Suggestions? I looked for it in the MSN library but didn´t find anything.
db.Execute("INSERT INTO Links (Linkadd, CategoryID2, LinkUser ) VALUES (@0,@1,@2)", link, categoriesna, WebSecurity.CurrentUserId);
}
Refresh();!? / Response
Mikesdotnett...
All-Star
154927 Points
19867 Posts
Moderator
MVP
Re: Refresh Page
May 04, 2012 04:48 AM|LINK
See if anything in this article helps you with your question: http://www.mikesdotnetting.com/Article/155/WebMatrix-And-jQuery-Forms
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
wcesaching7
Member
32 Points
11 Posts
Re: Refresh Page
May 04, 2012 12:03 PM|LINK
their is not a insert problem, once you click on send button your page will again reload so you have to control it by ajax update panel it will update only u r area where u r message is getting inserted one more thing in send button click event you can check where end of event u bind data to grid view.
+91-7798805999
mclazarini
Member
63 Points
57 Posts
Re: Refresh Page
May 04, 2012 08:19 PM|LINK
Thanks a lot... I´ll check it out this weekend. I was thinking that it would be easier to solve.
mclazarini
Member
63 Points
57 Posts
Re: Refresh Page
May 15, 2012 01:24 AM|LINK
Hi guys...
I have read the Mike´s article and tried to implement it.
Evething went fine until I tryed to add some new content. So, I tried to download the MiKe´s example and I got the same problem, which is...
[object XMLHttpRequest] - Everytime I try to post the data.
I´m using the Web Matrix Beta Version --- Isn´t it compatible with this version???
Thanks in advance.
mclazarini
Member
63 Points
57 Posts
Re: Refresh Page
May 15, 2012 10:49 AM|LINK
Actually my problem is quite simple.
I have an input text field which the user can insert an image address. So, I nedd to record it into the database and show it in the same page without reload. If the user insert another image the second one need to be showed with the first and so on.
Recording in database is Ok but I just don´t know where to find an app in Ajax (never worked with ) that I can customize or a function or helper in Web Matrix which could help me.
Anyone have any suggestion?
Thanks
Mikesdotnett...
All-Star
154927 Points
19867 Posts
Moderator
MVP
Re: Refresh Page
May 16, 2012 05:37 AM|LINK
The sample I provided shows how to do something similar. You need to spend a bit of time understanding how AJAX works properly. There are thousands of articles around that explain the basics. Once you understand those, what you want to do is pretty simple.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
mclazarini
Member
63 Points
57 Posts
Re: Refresh Page
May 16, 2012 11:33 AM|LINK
Ok Mike...
Thanks for you attention whit a newbie.
For now, I´m using a JavaScript code which I can refresh all page and keep the user querys, but ASAP I´ll study it more and then I´ll post the solution here.