Call A Method Or Function From Another Page

Jul 12, 2012

How can I call a method from another page. I have the following code to add row dynamically in grid view: 

<asp:GridView ID="dg2" runat="server" ShowFooter="true"
AutoGenerateColumns="False" BackColor="White" ForeColor="#0099FF"
HeaderStyle-BackColor="#0099FF" HeaderStyle-ForeColor="White" PageSize="2">
<Columns> <asp:TemplateField HeaderText="Item Code"> <ItemTemplate>

[Code] ....

In code behind

public void IntializeRow() { DataTable dt = new DataTable(); DataRow dr = null;
dt.Columns.Add(new DataColumn("itemcode", typeof(string)));
dt.Columns.Add(new DataColumn("itemname", typeof(string)));
dt.Columns.Add(new DataColumn("quantity", typeof(string)));
dt.Columns.Add(new DataColumn("mrng", typeof(string)));

[Code] ....

Some methods for initialize grid view row and set previous row record. There any possible to call this methods from another page? Or any possible to use the same grid view to use different page....

View 1 Replies


Similar Messages:

Call C# Method From Another Page In Javascript Function With JQuery

Mar 3, 2011

In GridViewData.aspx.cs I have a method I want to call inside a javacsript function.

[Code]....

Now hears the kicker, I am mostly using jqUery as UpdateInsertData() is a jquery Call and works fine. How do I use ValidateNameUpdateable to call jQuery to return the value from the c# method. . I believe this issue is with my jQuery Call as its just posting and I need to do a $.get or something?

function ValidateNameUpdateable()
{
$(document).ready(function ()
{
$.post("GridViewData.aspx")
});
}

View 4 Replies

User Controls :: Call A Method Or Function Inside UserControl From Web Page

Aug 1, 2012

I am having a Calculate() function in user control which is inherited in a page.

I need to call this method in the button click event in the page.

View 1 Replies

Call A .cs Method From A JavaScript Function?

Aug 15, 2010

I need to call a .cs method from JavaScript function; how can I do that?

View 2 Replies

VS 2005 - Call A MS Access Method / Function?

Feb 11, 2010

I am working on my company intranet and trying to integrate it with our existing MS Access applications.

I need to provide the ability to have the client click on a link/button from an aspx page and have it call a function in the MS access application to look up the corresponding record.

I came accross the thread [URL] but that is not really what I want as the ADP application will already be running on the client I just need to pass it a value.

Alternitively if I could start a new instance of the ADP passing it a parameter on open to find the correct record that would be a compromise.

View 19 Replies

MVC :: How To Call Action Method From Javscript Function

Feb 17, 2010

how to call a ASP.NET MVC controller action from a javascript function in related view.

Particularly I am trying do do this from a recursive timer function like this:

script type="text/javascript">
function ShowTime() {
var dt = new Date();
document.getElementById("<%= TextBox1.ClientID %>").value = dt.toLocaleTimeString();
---> // the controller action call: "/Controller/ShowImage"
window.setTimeout("ShowTime()", 1000);
}
</script>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<script type="text/javascript">
// a startup script to put everything in motion
window.setTimeout("ShowTime()", 1000);
</script>

The action result is an image (JPEG serialized array) for display.

View 8 Replies

Web Forms :: Tag Onclick Method Is Call Server Side Function?

Mar 12, 2010

<a href='#' id='edit' runat='server' OnClick='Edit(" + dt.Rows[j][0].ToString() + ")'>" + " Update " + "</a>

here Onclick called javascript but i want to called serverside function...what can i do (a href is Written from server side)

View 2 Replies

Web Forms :: Call Server Side Function Of Parent Page From Popup Page?

Mar 24, 2011

I open a pop up page(child page) by using jquery(jquery.colorbox.js) in asp.net application. now when I click on search button I want to close the pop up page(child page) and refresh the UpdatePanel1 by using search parameters. for above I need to execute server side function in parent page. code to close pop up:

child.aspx:
<script>
function closePopup() {
[Code]....

View 3 Replies

Web Forms :: How To Call A Javascript Function On A Master Page From A Content Page Control

Jan 24, 2011

I have a javascript function on my Master page, how do I access it with a dropdownlist of a content page. Not from codebehind, I can do that, but from the control itself such as the onSelectedIndexChanged event.

View 11 Replies

User Controls :: Call Function In Master Page From UserControl In Content Page

Jan 25, 2014

On MasterPage i have function below, how call this function on test.ascx  form on button click.

public void HideBtnLogin() { string session = Session["userCode"] as string; if (String.IsNullOrEmpty(session)) {
lbtnSignInTop.Visible = true; lbtnSignUp.Visible = true;
}
else { lbtnSignInTop.Visible = false; lbtnSignUp.Visible = false; } }

View 1 Replies

Web Forms :: How To Redirect To Another Page And Call Its Function From Source Page

Mar 13, 2011

I have 2 aspx page:

1>companyMaster(CM) 2>CompanyBranchMaster(CBM)

In CompanyMaster ihave a gridview (listing all companyBranches) with select,Update,Delete button on it.On clicking select of anyone row in gridview ,it should redirect to CompanyBranchMaster page and there is a funciton in it dbSelectGrid to show the details of that Branch in form.

CompanyBranchMaster page contains a form with all the required fields and gridview and its funcitons.

My Question is if user clicks on grid of CM then it can be redirected to CBM with Response.Redirect.But how to call the function dbSelectGrid of CBMs page.

View 5 Replies

Can Content Page Call A Function In Its Master Page

Jan 29, 2010

I have a site with a master page, Site.master. Many of Site.master's content pages have the same button that functions the same way on each page:

<asp:ImageButton ID="btn" runat="server" OnClick="btn_Click" />

Is it possible to write btn_Click once in Site.master's CodeFile and have it called in the OnClick attribute of each content page's button? I'm trying to avoid adding the same function (or anything at all) to each content page's CodeFile.

View 5 Replies

Can't Call Page Method From JQuery?

Jun 2, 2010

I have a page called AddNews.aspx and in codebehind a web method called AddNews(Parameters).. AddNews.aspx page is inherited from a master page.. So i used contentplaceholder. I have a button..It's id is btnSave.

$(function() {
$("[id$='_btnSave']").click(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
data: $.toJSON(veriler),
url: "AddNews.aspx/AddNews",
dataType: "json",
success: function(result) {
$("#result").html('News added');
},
error: function() {
alert('Problem');
}
});
});
});
</script>

Button click trigger now.. But it doesnt call Web Page Method.. What's the problem?

View 1 Replies

Call SQL Function With Multiple Parameters From C# Web Page?

Mar 30, 2010

I have an MS SQL function that is called with the following syntax: SELECT Field1, COUNT(*) AS RecordCount FROM GetDecileTable('WHERE ClientID = 7 AND LocationName = ''Default'' ', 10) The first parameter passes a specific WHERE clause that is used by the function for one of the internal queries. When I call this function in the front-end C# page, I need to send parameter values for the individual fields inside of the WHERE clause (in this example, both the ClientID & LocationName fields) The current C# code looks like this:

String SQLText = "SELECT Field1, COUNT(*) AS RecordCount FROM GetDecileTable('WHERE
ClientID = @ClientID AND LocationName = @LocationName ',10)";
SqlCommand Cmd = new SqlCommand(SQLText, SqlConnection);
Cmd.Parameters.Add("@ClientID", SqlDbType.Int).Value = 7; // Insert real ClientID
Cmd.Parameters.Add("@LocationName", SqlDbType.NVarChar(20)).Value = "Default";
// Real code uses Location Name from user input
SqlDataReader reader = Cmd.ExecuteReader();

When I do this, I get the following code from SQL profiler:

exec sp_executesql N'SELECT Field1, COUNT(*) as RecordCount FROM GetDecileTable
(''WHERE ClientID = @ClientID AND LocationName = @LocationName '',10)',
N'@ClientID int,@LocationID nvarchar(20)',
@ClientID=7,@LocationName=N'Default'

When this executes, SQL throws an error that it cannot parse past the first mention of @ClientID stating that the Scalar Variable @ClientID must be defined. If I modify the code to declare the variables first (see below), then I receive an error at the second mention of @ClientID that the variable already exists.

exec sp_executesql N'DECLARE @ClientID int; DECLARE @LocationName nvarchar(20);
SELECT Field1, COUNT(*) as RecordCount FROM GetDecileTable
(''WHERE ClientID = @ClientID AND LocationName = @LocationName '',10)',
N'@ClientID int,@LocationName nvarchar(20)',
@ClientID=7,@LocationName=N'Default'

I know that this method of adding parameters and calling SQL code from C# works well when I am selecting data from tables, but I am not sure how to embed parameters inside of the ' quote marks for the embedded WHERE clause being passed to the function.

View 1 Replies

Web Forms :: Call Function When Page Close?

Mar 27, 2011

I want to call a function (VB, server side function) when the page is close.

View 4 Replies

Call Page Method Masterpage From Jquery

Feb 10, 2010

how does one call a page/webmethod which is based on a masterpage file from jquery?

View 7 Replies

Use JQuery To Call AJAX Page Method?

Feb 2, 2010

How to use jQuery to call ASP.NET AJAX Page Method?

View 1 Replies

Web Forms :: How To Call A Function In The Masterpage From Its Content Page

Feb 25, 2011

How can I call a function in the masterpage from its content page I have a function in my master page to populate a tree view in the master page. After entering some database values from the contentpage I want to call the master page function to show the entered value in the treeview.

View 4 Replies

Web Forms :: How To Call A JavaScript Function After Page Loads

Apr 19, 2010

I don't need to run the function every time the page loads!!

But, I would like to have the control when the function is to be called.

The only way I thought of is calling my function with OnLoad in the body tag and having a hidden field to be checked and then run the script accordingly.

e.g:

<body onload="ScrollToView();">

Is there a better way? For example, running the function from Page_InitComplete handler?

View 15 Replies

How To Call Page Method Without Script Manager From Jquery

Mar 16, 2011

How to call page method from jquery without using scriptmanager

View 2 Replies

JQuery :: How To Call A Javacript Method In A PageLoad Of A Page

Aug 10, 2010

How to call a Javacript method in a PageLoad of a Page?

View 5 Replies

Can Call Method That Exist On Aspx Page Through Web Service

Feb 24, 2011

Can we call a Method that exist on a aspx page through Web Services.

It is like Reflection that method exists in dll form , but is it possible to call method from Aspx page.

View 2 Replies

Web Forms :: How To Force Page To Call ApplyStyleSheetSkin Method

Oct 1, 2010

I have a few custom composite controls that set their cssclass only when calling their ApplyStyleSheetSkin method.I worked around this by creating a function which recursively walks through all controls on a page and calls that method, but I was wondering if there isn't a way to do this automatically? (i.e. how do I tell the aspx page to call the ApplyStyleSheetSkin method inside the controls?

View 1 Replies

C# - Call Page Method After Usercontrol Events Ends?

Nov 22, 2010

How can i call a page method after a usercontol finished his method / fire a parent page method from inside the user control insted?

View 1 Replies

Web Forms :: How To Call A Javascript Method While Using A Master Page

Mar 30, 2010

I am using the application.master of sharepoint server 2007 as the master page for my application. i want to call a custom javascript method( OnLoadFun) that i have put in the PlaceHolderAdditionalPageHead asp:content section surrounded within script tags.

Since i can not put a body tag to call the method as onload=OnLoadFun() inside the asp:content, how do i call the mehtod during body load?

I tried writing window.onload=OnLoadFun; embedded with in script tag inside the asp:content main placeholder ..

Below is the function i want to call during page load....

[Code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved