Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Wednesday, March 28, 2012

Multiple UpdatePanel query

In my web application, on one page I'm having 4 UpdatePanel. All data corresponding to this UpdatePanel comes from database, so there is a substantial waiting time. When the page gets loaded, data for each UpdatePanel gets loaded 1 at a time.Can I load data for all sections asynchronously? Since this can help my application to reduce the loading time. Or it's not possible to start another request before the 1st one is complete?Any help will be appreciated.

Hi

I am not sure abt ur first issue but i think that in case you can do synchronization.

Tell me if you get any help regarding your blog..

Thanx


Please refer to this: http://forums.asp.net/t/1108522.aspx


Thanks for your reply. I have referred that post, before posting this query.

Can you provide me with some document if you have any.


To have a good understanding of the life cycle of async-request is helpful. Please refer to this for more information, http://ajax.asp.net/docs/overview/AJAXClientEvents.aspx

With the UpdatePanels, only one asynchronous request is handled at a time. This is intentional because these request include the ViewState on the page and make it almost impossible to keep it all in sync if multiple requests are occuring simultaneously. Raymond is correct in mentioning that you should get a good grasp of the life cycle that happens during these request - there is the asp.net page lifecycle, but there is also a client-side lifecycle. In short, become familiar with the PageRequestManager, this client-side object will grant you more control of what goes on during these ajax postbacks. Lastly, check out this sample to see how to work with the client-side events:http://weblogs.asp.net/davidbarkol/archive/2007/03/25/asp-net-ajax-client-side-event-viewer.aspx


Thanks Raymond and David for your suggestion.

Saturday, March 24, 2012

Need assistance with popup making an AJAX/Webservice

Hi - I would like to have a popup panel appear on a roll-over of an image and then for that panel to call a webservice that hits a database on the backend to populate a gridview. But I have no idea where to start. I would like this panel to have the progress indicator while the grid is loading. Any links/help would be very greatly appreciated.

Thank you,
daveIn the Atlas framework, look at the UpdateProgress control. In the AtlasControlToolkit, check out the HoverMenuExtender and DynamicPopulateExtender.
Thank you. I'm looking now :)

Wednesday, March 21, 2012

need help for UpdatePanel

Hi

I created one page with AJAX.Net. My page is as follow. It is working fine. but When I click on Save button It save the data into the database and reset the Controls value[using ResetControls() methods]. this method is fired but it is not reset the controls value. I do not know why? Can Any body help me? I put my .aspx and Save button event.

<

asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"></asp:ScriptManager>

<

asp:UpdatePanelID="UpdatePanel1"runat="server">
<ContentTemplate>

<tablecellspacing="0"cellpadding="2"width="97%"border="0"align="center">
<tr><tdalign="right"style="height: 28px"width="18%"></td><tdstyle="height: 28px"width="2%"></td><tdclass="ItemDetail"style="height: 28px"width="80%">
<asp:LabelID="lblMessage"runat="server"SkinID="errorLable"></asp:Label></td></tr></table>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTriggerControlID="btnSave"EventName="Click"/>
</Triggers>

</asp:UpdatePanel>

<tablecellspacing="0"cellpadding="2"width="97%"border="0"align="center">
<tr><tdwidth="18%"style="height: 28px"align="right"><asp:LabelID="lblDate"runat="server"Text="Date"SkinID="requiredLabel"></asp:Label></td>
<tdwidth="2%"style="height: 28px"> </td><tdwidth="80%"class="ItemDetail"style="height: 28px">
<asp:TextBoxID="txtDate"runat="server"Columns="15"MaxLength="12"></asp:TextBox>
<asp:Imagerunat="Server"ID="Image1"ImageUrl="~/images/cal.gif"ToolTip="Click to show calendar"style="border-width:0px;"DescriptionUrl="#"/>
<cc1:CalendarExtenderID="CalendarExtender1"runat="server"Format="MMMM d, yyyy"TargetControlID="txtDate"BehaviorID="CalendarExtender1"PopupButtonID="image1">
</cc1:CalendarExtender>
</td></tr><tr><tdalign="right"><asp:LabelID="lblSpeaker"runat="server"Text="Speaker"SkinID="requiredLabel"></asp:Label></td><td> </td><tdclass="ItemDetail">
<asp:TextBoxID="txtSpeakerName"runat="server"Columns="30"MaxLength="50"></asp:TextBox></td></tr>

<tr><tdalign="right"><asp:LabelID="lblTopic"runat="server"Text="Topic"></asp:Label> </td><td> </td><tdclass="ItemDetail">
<asp:TextBoxID="txtTopic"runat="server"Columns="45"MaxLength="100"></asp:TextBox></td></tr
<tr><tdvalign="top"align="right"><asp:LabelID="lblComments"runat="server"Text="Comments"></asp:Label> </td><td> </td><tdclass="ItemDetail">
<tablecellpadding="2"cellspacing="0"border="0"><tr><td>
<FTB:FreeTextBoxID="txtComments"runat="server"AllowHtmlMode="True"BreakMode="LineBreak"
ButtonSet="OfficeXP"ConvertHtmlSymbolsToHtmlCodes="True"DisableIEBackButton="True"Height="175px"SupportFolder="/CRRoot/FreeTextBox/"ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,InsertRule|Cut,Copy,Paste;Undo,Redo,Print,InsertImageFromGallery"></FTB:FreeTextBox> </td></tr></table></td></tr
<tr><tdclass="ItemHeading"valign="top"align="right"></td><td></td><tdclass="ItemDetail"></td></tr
<tr><tdcolspan="3"class="CommandBar"> <asp:ButtonID="btnSave"runat="server"Text=" Save "OnClick="btnSave_Click"AccessKey="S"/>
<asp:ButtonID="btnCancel"runat="server"Text=" Cancel "CausesValidation="False"OnClick="btnCancel_Click1"AccessKey="C"/></td></tr
</table
===============================

protectedvoid btnSave_Click(object sender,EventArgs e){

string Errors = validation();
if (Errors.Length > 0)
{
lblMessage.Text = Errors;
lblMessage.Visible =true;
return;}DateTime SpeakerDate =DateTime.Today;
DateTime.TryParse(txtDate.Text.Trim(),out SpeakerDate);
string SpeakerName = txtSpeakerName.Text.Trim();
string Topic = txtTopic.Text.Trim();
string Comments = txtComments.Text.Trim();
string Action = ((Utilities.ProcessStatus)this.ProcessMode).ToString();
int Success =Speaker.SpeakerAddEditDelete(CookiesInfo.ClubId,this.SpeakerId, SpeakerDate,
SpeakerName, Topic, Comments, Action);
if (Success == -1)
{
lblMessage.Text =" - Record has not been saved. Please check the inputs.";
lblMessage.Visible =true;
}else{
ResetControls();
lblMessage.Text =" - Record has been saved successfully.";
lblMessage.Visible =true;
}
}privatevoid ResetControls(){

txtDate.Text =String.Format("{0:MMMM d, yyyy}",DateTime.Today);
txtSpeakerName.Text =string.Empty;
txtComments.Text =string.Empty;
txtTopic.Text =string.Empty;

}

The textboxes are not part of the UpdatePanel's ContentTemplate.

hence , inaccessible from the server.

Move them inside the UpdatePanel and they will be accessible .

Hope this helps

Need help with implementing google map with Ajax

Hi, i am making use of the Google maps to save a location, i wanted to save the lat and lng value of the marker into my database, but without any success. Could someone enlighten me pls, many thanks in advance

<%@dotnet.itags.org. Page Language="VB" %
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
Protected Sub post_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Try
eventDataSource.Insert()
Catch ex As Exception

End Try
End Sub
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>map</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<link href="http://links.10026.com/?link=jiawei.css" rel="stylesheet" type="text/css" />
<script src="http://pics.10026.com/?src=http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATWDgkaMeL60f_hR3JzHgQBRBZbUqgwWQv7nmLu01TGDQYDe1qhRYsXRdid8s1O4VSMi4tlCJ6WMXJA"
type="text/javascript"></script>

<script type="text/javascript"
//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 13);

GEvent.addListener(map, "click", function(marker, point) {
if (marker) {
map.removeOverlay(marker);
} else {
map.addOverlay(new GMarker(point));
}
var slat=point.lat();
var slng=point.lng();
document.getElementById('lat').innerHTML=slat;
document.getElementById('lng').innerHTML=slat;

});
}
}

//]]>
</script>
</head>
<body id="event" onload="load()" onunload="GUnload()">
...

<div id="map" style="width: 600px; height: 400px"></div>
<asp:Label ID="lat" runat="server" Text=""></asp:Label>
<asp:Label ID="lng" runat="server" Text=""></asp:Label><br />
<asp:Button ID="post" runat="server" Text="Post" ><br />
......
</body>
</html>.

Hi There,

jwillbe:

Hi, i am making use of the Google maps to save a location, i wanted to save the lat and lng value of the marker into my database, but without any success. Could someone enlighten me pls, many thanks in advance

<%@. Page Language="VB" %
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
Protected Sub post_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles post.Click


Try
'eventDataSource.Insert() DO YOUR INSERT HERE
Catch ex As Exception

End Try
End Sub
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>map</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<link href="http://links.10026.com/?link=jiawei.css" rel="stylesheet" type="text/css" />
<script src="http://pics.10026.com/?src=http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATWDgkaMeL60f_hR3JzHgQBRBZbUqgwWQv7nmLu01TGDQYDe1qhRYsXRdid8s1O4VSMi4tlCJ6WMXJA"
type="text/javascript"></script>

<script type="text/javascript"
//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 13);

GEvent.addListener(map, "click", function(marker, point) {
if (marker) {
map.removeOverlay(marker);
} else {
map.addOverlay(new GMarker(point));
}
var slat=point.lat();
var slng=point.lng();
document.getElementById('lat').innerHTML=slat;
document.getElementById('lng').innerHTML=slat;

document.getElementById('post').click(); // you can use this to click the button when you make a marker



});
}
}

//]]>
</script>
</head>
<body id="event" onload="load()" onunload="GUnload()">
...

<div id="map" style="width: 600px; height: 400px"></div>
<asp:Label ID="lat" runat="server" Text=""></asp:Label>
<asp:Label ID="lng" runat="server" Text=""></asp:Label><br />
<asp:Button ID="post" runat="server" Text="Post" ><br />
......
</body>
</html>.

Please refer to the bold line.

1) Add event handler to post button

2) When you click on google map, use that event to trigger your button too.

e.g

document.getElementById('post').click(); // you can use this to click the button when you make a marker


i tried ur method, but the lat and lng values are still unable to save into my database, btw the lat n lng attributes are set to String data type in my database

Hi There,

By the way, did you set parameter value to your datasource

e.g. say your eventdatasource insert startment have 2 parameter. lat and lng

eventDataSource.InsertParameters["lat"].DefaultValue = lat.Text;

eventDataSource.InsertParameters["lng"].DefaultValue = lng.Text;

'eventDataSource.Insert() DO YOUR INSERT HERE

If above not working

Did you add insert statement to your eventdatasource ?

Can you should me your datasource.


i don't quite get ur question do u mean this?

<InsertParameters>
<asp:ControlParameter ControlID="tb_eventTitle" DefaultValue="" Name="eventTitle"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="fromDate" DefaultValue="" Name="fromDate" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="toDate" DefaultValue="" Name="toDate" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="fromTime" DefaultValue="" Name="eventTimeHr" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="toTime" DefaultValue="" Name="eventTimeMin" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="tb_desc" DefaultValue="" Name="eventDesc" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="tb_venue" DefaultValue="" Name="eventVenue" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="lat" Name="lat" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="lng" Name="lng" PropertyName="Text" Type="String" />
</InsertParameters>


Hi There,

Yes, this is what im talking about.

In your

Protected void post( object sender, System.EventArgs e )

{

// on save your data, you require to set the value to your parameter // like following

eventDataSource.InsertParameters["lat"].DefaultValue = lat.Text;

eventDataSource.InsertParameters["lng"].DefaultValue = lng.Text;

}


hi there, i am quite new in programming, where do i put that piece of code to?


hi there, i am new to programming, where do i put that piece of code into?


Hi There,

Didn't notice that you are using VB.

Put the code as below

<script runat="server"
Protected Sub post_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles post.Click

Try

' SET YOUR PARAMETER VALUE BEFORE INSERT

eventDataSource.InsertParameters["lat"].DefaultValue = lat.Text

eventDataSource.InsertParameters["lng"].DefaultValue = lng.Text

' AND ALL OTHER VALUE THAT YOU NEED TO IN YOUR INSERT STATEMENT


eventDataSource.Insert() DO YOUR INSERT HERE


Catch ex As Exception

End Try

End Sub


</script>

Also, have a look at this tutorial, it give you idea how to use datasourcehttp://www.asp.net/learn/dataaccess/default.aspx?tabid=63


hi there, i am using the sqldatasource control, the insert statement was already created

INSERT INTO [eEvent] ([eventTitle], [fromDate], [toDate], [eventTimeHr], [eventTimeMin], [eventDesc], [eventVenue], [lat], [lng]) VALUES (@.eventTitle, @.fromDate, @.toDate, @.eventTimeHr, @.eventTimeMin, @.eventDesc, @.eventVenue, @.lat, @.lng)

thx a lot anyway


Hi There,

jwillbe:

INSERT INTO [eEvent] ([eventTitle], [fromDate], [toDate], [eventTimeHr], [eventTimeMin], [eventDesc], [eventVenue], [lat], [lng]) VALUES (@.eventTitle, @.fromDate, @.toDate, @.eventTimeHr, @.eventTimeMin, @.eventDesc, @.eventVenue, @.lat, @.lng)

You have to pass value to the sqldatasource as argument ( e.g. value for (@.eventTitle, @.fromDate, @.toDate, @.eventTimeHr, @.eventTimeMin, @.eventDesc, @.eventVenue, @.lat, @.lng)

My previous post is teaching you how to set value to it.


Can the datasource wrong? Check again.