Showing posts with label samples. Show all posts
Showing posts with label samples. Show all posts

Wednesday, March 28, 2012

How do I manually trigger a nextpage for the data navigator?

So I'm already familiar with

http://atlas.asp.net/docs/util/srcview.aspx?path=~/atlas/samples/data/DataNavigator.src

and I can get it to work with buttons

but lets say we replaced those buttons with anchor tags instead?

oh wait I just figured it out. You don't do anything just chaging those elements to anchors and leaving them labeled as buttons in the XML markup causes the same behavior.. That's cool. why is that? My guess is because anchor and button both have the exact same onclick event which is the event that is raised.

OK well than for academic reasons how would I invoke a next page on a DataNavigator without a button like lets say from a hyperlink object or from javascript code?

I tried creating a datanavigator object in javascript code

var

pageNavigator =new Sys.UI.Data.DataNavigator($("pageNavigator"));

pageNavigator.initialize();

alert(pageNavigator.get_dataView());

pageNavigator.onBubbleEvent(

null,"nextpage");

but that didn't work at all.

All the DataNavigator control does is increment the pageIndex property on its associated DataView component. Knowing that, you can easily do the same thing:

var dataView = $object('dataView');
dataView.set_pageIndex(dataView.get_pageIndex() + 1);

Hope that helps.

--
Jason

Wednesday, March 21, 2012

How Can i Get the new Values from the PopupWindow in Atlas ModalPopupWindow with samples

if i change the textbox values in Popupwindow and if i click the ok button (ServerSide code) I cant get the new values from the popup window in modalpopupExtender.Anyone Please help me how can i get the new values from the popupwindow in atlas modalpopupExtender.Explain with simple example.

Thanks

Hi,

Try this:

<%@. 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 Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Text = DateTime.Now.ToString()
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="always">
<ContentTemplate>
<asp:Panel ID="Panel1" onscroll="javascript:saveScroll();" runat="server" Height="50px" Width="125px" Style="position: static;
overflow: scroll; height: 350px; border: solid 1px blue; background-color: White;
display: none;">
<table border="0" cellpadding="0" cellspacing="0" width="480px">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
<asp:Button ID="Button1" runat="server" Text="Update" OnClick="Button1_Click" />
<asp:Button ID="Button3" runat="server" Text="Close" />
<asp:Button ID="Button4" runat="server" Text="OK" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
<asp:Button ID="Button2" runat="server" Text="Show" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" OkControlID="Button4"
CancelControlID="Button3" TargetControlID="Button2">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

<script type='text/javascript'>
var scrollLeft = 0;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args) {
document.getElementById('Button2').click();
setScroll();
}

function setScroll()
{
document.getElementById('<%= Panel1.ClientID %>').scrollLeft = scrollLeft;
}

function saveScroll()
{
scrollLeft = document.getElementById('<%= Panel1.ClientID %>').scrollLeft;
}
</script>

</body>
</html>

Get the value in javascript via "document.getElementById('TextBox1').value".

Best Regards