Showing posts with label insert. Show all posts
Showing posts with label insert. Show all posts

Wednesday, March 28, 2012

Very new to AJAX. Want to insert a record into a database...

Hello everyone,

I am very new to ASP.NET AJAX. I just simply want to insert a new record into a database...

I have a calender, which is using DayRender to highlight days that have meetings on them (pulled from "Meeting" table in database).

When a user selects a date that DOESN'T have a meeting, i want an "Add" button to show that will simply add the calendar's selected date to the Meeting table (the table only has two fields, ID and Date)

I'd like for this to all be AJAXified, so when a user selects a date...it does a partial page render to show the add button (or delete button if there IS a meeting for the selected date already), then when they click the "add" button, it inserts the selected date with a partial page render (or however it works).

Can anyone point me in the right direction? Do I have to create a web service? can i do this just using UpdatePanels? Can someone possibly provide some starter code?

Thanks in advance!

hello.

well, since you're starting, i'd say that this can be done by rather easily with UpdatePanels. Even though i still think they shouldn't be used in most scenarios, the truth is that ~using them makes building ASP.NET AJAX pages easy since you can do most of things on the server side...

Saturday, March 24, 2012

watermark extender and javascript?

Hi, i have a textbox on the page. When the user clicks on a username in the list to the right i use this javascript to insert their username into the textbox.

function

setTextBoxText(text)
{
var textbox = window.document.getElementById("<%=touser.ClientID%>");
textbox.value ='';
textbox.value = text;
textbox.focus();
}

This works perfectly.

Then i tried to add a TextboxWatermarkExtender and now it does not work anymore, the initial text in the textbox (set by the watermark extender) gets erased, but the username does not show up, it just turns blank and focus is set on the textbox. Is there anyway to fix that?

Patrick

any idea?

I tested this out yesterday and found out that when you use WaterMarked on your textbox, all of the changes to the textbox through javascript will be written to watermarked's layer.

e.g. you have a textbox with onchange or onfocus command to call a javascript function; and the textbox also has a watermarked "Enter Name Here"

Your JavaScript function will insert the user's name into the textbox.

document.getElementById('" & Me.textbox1.ClientID & "').value = 'John Smith';

Problem: What happen is, "Enter Name Here" will be replaced with "John Smith", and the textbox is still empty.


Question, is this a bug or is it as design?