Is it possible to reference a linkbotton outside an update p

THIS IS THE SITE.MASTER ASPX PAGE<%@ Master Language=”C#” AutoEventWireup=”true” CodeBehind=”Site.master.cs” Inherits=”Prototype4.SiteMaster” %><%@ Register Assembly=”AjaxControlToolkit” Namespace=”AjaxControlToolkit” TagPrefix=”asp” %>alert(“JS code in general: OK”); $(function () $(“#lnkShowOtherPage”).click(function () alert(“OtherPagePanel length: ” + $(“#OtherPagePanel”).length); alert(“OtherPagePanel load: ” + $(“#OtherPagePanel”).load); $(“#OtherPagePanel”…

via Asp.Net Developed Tutorials » Search Results » ajax:

Is it possible to reference a linkbotton outside an update p

THIS IS THE SITE.MASTER ASPX PAGE
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Prototype4.SiteMaster" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
alert(“JS code in general: OK”); $(function () $(“#lnkShowOtherPage”).click(function () alert(“OtherPagePanel length: ” + $(“#OtherPagePanel”).length); alert(“OtherPagePanel load: ” + $(“#OtherPagePanel”).load); $(“#OtherPagePanel”).load(“/EntryForms/OpenCase.aspx”); ); });
function updateClock()
var currentTime = new Date();

var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
var currentSeconds = currentTime.getSeconds();

// Pad the minutes and seconds with leading zeros, if required
currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;

// Choose either “AM” or “PM” as appropriate
var timeOfDay = (currentHours < 12) ? "AM" : "PM";

// Convert the hours component to 12-hour format if needed
currentHours = (currentHours > 12) ? currentHours – 12 : currentHours;

// Convert an hours component of “0″ to “12″
currentHours = (currentHours == 0) ? 12 : currentHours;

// Compose the string for display
var currentTimeString = currentHours + “:” + currentMinutes + “:” + currentSeconds + ” ” + timeOfDay;

// Update the time display
document.getElementById(“clock”).firstChild.nodeValue = currentTimeString;
Case Management System Welcome ! [ ] <%--Welcome: !--%>
Welcome: Guest [ Log In ]

<%-- [ ] –%>



ImageUrl=”~/homeIcon.png”/>
ImageUrl=”~/aboutIcon.png”/>
Text=”Contact Us” Value=”Contact Us”>

class=”fnctButton” Height=”25px” Width=”70px” />

This is a place holder for some real text that is displayed regarding news within the departement and additional links to external sites for news.

class=”fnctButton” Height=”25px” Width=”170px” />

AND THIS ONE IS THE CASE ADMIN PAGE BASED ON THE MASTER PAGE. THERE ARE TWO BUTTONS ON THE LEFT NAVIGATION PANE THAT SHOULD LOAD A THIRD PAGE (OPENCASE OR ADDEXHIBIT) IN THE CENTRE SPACE DEPENDING ON WHICH BUTTON IS CLICKED. THE CASE ADMIN PAGE .ASPX BELOW.
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CaseAdmin.aspx.cs" Inherits="Prototype4.CaseAdmin" %> <%@PreviousPageType VirtualPath="~/Account/Login.aspx"%>

Open Case

runat=”server” onclick=”RegisterExhibitLinkButton_Click”>Register Exhibit

THIS SECTION REPRESENTS THE CODE BEHIND FOR THE CASEADMIN PAGE THUS THE .CS CODES
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace Prototype4 public partial class CaseAdmin : System.Web.UI.Page //string userid; //string strUsername; protected void Page_Load(object sender, EventArgs e) //strUsername = Session[“Username”].ToString(); //public String AdminUserID // // get // // //return userid; // //}
//userid = PreviousPage.AdminID;

//Response.Redirect(“~/EntryForms/OpenCase.aspx”, false);

/* if (PreviousPage != null)

TextBox SourceTextBox =
(TextBox)PreviousPage.FindControl(“UserName”);
if (SourceTextBox != null)

userid = SourceTextBox.ToString();

}*/

protected void RegisterExhibitLinkButton_Click(object sender, EventArgs e)

Response.Redirect(“~/EntryForms/AddExhibit.aspx”, false);

}
}
THIS IS ONE OF THE TWO PAGES THAT SHOULD LOAD DEPENDING ON THE BUTTON CLICK. I HAVE ATTACHED THE CODE FOR THE OPENCASE FORM SO THAT WOULD CORRESPOND WITH THE OPENCASE LINK BUTTON ON THE LEFT. OPENCASE.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OpenCase.aspx.cs" Inherits="Prototype4.EntryForms.OpenCase" %>
<%@PreviousPageType VirtualPath="~/CaseAdmin.aspx" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
.casePage width: 430px; height:314px; background-color:#3a4f63; .style1 font-weight: normal; color: #FFFFFF; text-align: center; .style2 font-weight: normal; color: Black; text-align: left; margin-left: 20px; margin-top:0px;

.style3

width: 85%;

.style4

width: 175px;
background-color: #808080;

.style5

background-color: #CCCCCC;
padding-left:10px;

Open Case Form

Case ID:

runat=”server” height=”22px” width=”154px”>

Case Description:

runat=”server” height=”22px” width=”154px”>

Case Administrator ID:

ID=”caseAdminIDTextBox” runat=”server” height=”22px” width=”154px”>

onclick=”openCaseBotton_Click” /> onclick=”addExhibitBotton_Click” /> onclick=”cancelButton_Click” />

AND LASTLY THE OPENCASE.CS PAGE
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Configuration;
namespace Prototype4.EntryForms public partial class OpenCase : System.Web.UI.Page string adminString; protected void Page_Load(object sender, EventArgs e) adminString = “CA123”;
protected void openCaseBotton_Click(object sender, EventArgs e)

//SQL connection string
SqlDataSource CSMDataSource = new SqlDataSource();
CSMDataSource.ConnectionString = ConfigurationManager.ConnectionStrings[“CMSSQL3ConnectionString”].ToString();

//SQL Insert command with variables
CSMDataSource.InsertCommandType = SqlDataSourceCommandType.Text;
CSMDataSource.InsertCommand = “INSERT INTO Filing (FilingID, FilingDesc, DateOpened, FilingPriority, AdministratorID) VALUES (@FilingID, @FilingDesc, @DateOpened, @FilingPriority, @AdministratorID)”;

//Actual Insertion with values from textboxes into databse fields
CSMDataSource.InsertParameters.Add(“FilingID”, caseIDTextBox.Text);
CSMDataSource.InsertParameters.Add(“FilingDesc”, caseDescTextBox.Text);
CSMDataSource.InsertParameters.Add(“DateOpened”, DateTime.Now.ToString());
CSMDataSource.InsertParameters.Add(“FilingPriority”, null);
CSMDataSource.InsertParameters.Add(“AdministratorID”, adminString.ToString());

int rowsCommitted = 0;

//Try catch method to catch exceptions during insert
try

rowsCommitted = CSMDataSource.Insert();

catch (Exception ex)

//error message displayed when exception occurs

string script = ““;
Response.Write(“The following Error occurred while entering the records into the database” + ” ” + ex.ToString() + ” “);
Response.Redirect(“~/ErrorPage.aspx”, false);

finally

CSMDataSource = null;

//Where to go next if insert was successful or failed
if (rowsCommitted != 0)

Response.Redirect(“~/CaseAdmin.aspx”, false);

else

Response.Redirect(“~/ErrorPage.aspx”, false);

}

protected void addExhibitBotton_Click(object sender, EventArgs e)

Response.Redirect(“~/EntryForms/AddExhibit.aspx”, false);

protected void cancelButton_Click(object sender, EventArgs e)

Response.Redirect(“~/CaseAdmin.aspx”, false);

}
}
ALL I WANT TO DO IS GET THE RESPECTIVE PAGES TO LOAD INSIDE THE MAIN CONTENT AREA (THE MIDDLE SECTION) WITHOUT RELOADING THE PAGE. ITS BEEN A LONG WAY COMING BUT PROVED SUCCESSFUL WITH A LOT TO LEARN BUT I JUST WANT TO KNOW HOW I CAN APPLY THIS SAME TECHNIQUE TO THE OTHER BUTTON CLICK(ADD EXHIBIT) SINCE IN THE AJAX CODE IN THE HEADER OF THE MASTER PAGE SPECIFIES THE URL ON JUST ONE PAGE. HOW DO I DO THAT FOR SUBSEQUENT PAGES THAT USE THE MASTER PAGE AND WOULD BE DOING SIMILAR ACTIONS. FOR EXAMPLE THE CASE MANAGER PAGE THAT LOOKS LIKE THIS.
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CaseManager.aspx.cs" Inherits="Prototype4.CaseManager" %>
This is a place holder for allerts about cases to which the investigator has been assigned to.

Allocate Officer

Reallocate Officer

Prioritize Case

Open Case

Register Exhibit

I WANT TO TO DO SOMETHING SIMILAR LIKE IN THE CASE ADMIN PAGE BUT AM WONDERING WHAT THE CODES WILL ADD UP TO BE LIKE IN THE MASTER PAGE.
THANKS…
……………………………………….

I actually just wanted to load a form that is created in another asp. page into the main content area…
I fear that what you need is not UpdatePanel but rather “ordinary” AJAX loading that other page contents into some element.. using jQuery it’s as simple as:
$(“#OtherPagePanel”).load(“OtherPage.aspx”);
Where OtherPagePanel is the ID of some element in your .aspx code.
You can pass parameters to the other page over the URL, if you need to Post data it’s still possible but requires some extra lines – let us know in such case.
Edit:
In the placeholder where you want the data from other page to appear, have this:

Have such link in the other placeholder: (no need in LinkButton, ordinary HTML link is enough)
Show other page
Now in the section of your master page add this code and it’s all done:


You can also copy the jQuery.min.js file to your own server and change the src accordingly.
Edit 2:
In order to debug add such lines to the code, it will tell what went wrong:

Reload the page and let us know what alerts you get.
Edit 3:
Based on the previous debug results, have this code now:

Edit 4 and hopefully last:
In order to load different page into different div by clicking different button in addition to everything you already have, have such code:

……………………………………….

Is it a postback trigger or an async postback trigger?
i think you can register controls as post back or async on a script manager level with:
Control oControl;
ScriptManager1.RegisterAsyncPostBackControl(oControl);
you could try that

For more info: Is it possible to reference a linkbotton outside an update p

Asp.Net Developed Tutorials » Search Results » ajax

Is it possible to reference a linkbotton outside an update p

Tags: · · · · ·

Share this post:

Related Posts

Leave a Comment