C# - Call A Shared Function Which Its Name Came As A Parameter?

Jun 21, 2010

In a method, I want to call a shared function which its name came as a parameter. For example:

private shared function func1(byval func2 as string)
'call func2
end function

View 2 Replies


Similar Messages:

WCF / ASMX :: How To Call A Non Shared Function In A Shared Function

Nov 12, 2010

I want to call a non shared function in a shared function in which i am having a textbox control instance. Its giving no error but when i call this shared function from client callback it gives me no response

Any Idea except removing shared from the function.

Here is my code :

<WebMethod()> _
Public Shared Function myF() As String
Dim pg As New _Default
Return "{'Hello':'" & pg.setText & "'}"
End Function
Public Function setText() As String
Dim pg As New _Default
pg.TextBox1.Text = "This is a test"
Return pg.TextBox1.Text
End Function

View 2 Replies

Using Shared Function In A Separate DLL

Jan 18, 2011

I have CMS and FAQ as 2 different modules/projects each uses a different DLL file. When those two modules was structured as the same application. I was using the following piece to get the FAQs categories as part of my menu

[Code]....

Now those two modules are separated. .. Can I use the following shared function which is already exist in the FAQ separate DLL to loop the categories? and how can I do it?

[Code]....

View 5 Replies

Refer Shared Function In Its Own Class?

Mar 2, 2010

how to refer shared function in a class , this function itself inside same class

public class cls1

Public Shared Function getDBDate(ByVal pDate As Date) As String
Return Format(pDate, "yyyy-MM-dd")
End Function

Private Function GetDb_Format(ByVal pDateString) As String
Dim d As Date = Me.ParseDate(pDateString)
Return clsDate.getDBDate(d)

End Function

End Class

can i have any other way to use getDbDate function

View 2 Replies

Calling Other Functions From A Shared (or Static) Function

Aug 20, 2010

I get this error: Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

Partial Class _Default
Inherits System.Web.UI.Page
<WebMethod()> _
Public Shared Function ParseData() As String
Dim value as string = GetValue()
End Function
Private Function GetValue() as String
Return "halp"
End Function
End Class

I know it has something to do with the fact that the first function is shared and the second function should probably be Public as well but I don't fully understand the reason behind it. Probably not relevant but I'm calling the web method from some javascript.

View 1 Replies

How To Display Message Boxes In Shared Function

Jan 9, 2012

My problem is that IIS does not support alert and message boxes.so i am using

Me.Page.ClientScript.RegisterStartupScript(Me.GetType(), "SetStatusText", "<script type='text/javascript'> alert('In catch...On page load.'); </script>")

but it is not working in shared function as i am calling shared function from javascript.

i want to show an alert box in the shared function.

below is my function

Code:
<System.Web.Services.WebMethod()> _
Public Shared Function DeleteCircular(ByVal cilr_code As Int64, ByVal status As String, ByVal from_period As Date, ByVal to_period As Date) As Integer
If status = "delete" Then
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim sql, connstr As String

[code]....

View 10 Replies

Call Javascript Function And Server Side Function From Linkbutton

Jan 27, 2010

<asp:LinkButton CssClass="button" ID="btnApply" runat="server" OnClick="btnApply_Click()" OnClientClick="Apply1('btnApply')" >
hi ihave this functin in .vb file
Protected Sub btnApply_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnApply.Click
end sub

and javascript function also in aspx

function ApplySummerization(id)
{
alert("hai");
}

View 4 Replies

Web Forms :: Call Javascript In Codebehind (one Function But Twice Call)

Dec 13, 2010

i have a question about call javascript in codebehind. my page has two parts.one part for enter information about manager and another part for usualuser.each person has mellicode.that it has speicail code.i wrote it with javascript and call it with this code:

[Code]....

when i click in btnpazireshsabt i should check mellicode for manager.i call it :

[Code]....

i want to disable btnsabt when i click in

[Code]....

View 5 Replies

How To Jquery Call A Other Call Function Other Class Is Not Static

Sep 16, 2010

how to jquery call a other call function other class is not static

[WebMethod]
public static bool Verify(string username, string password)
//Do your logic with username, password here
//I am just checking with admin/admin credentials
Console.WriteLine("Ritu");
[code]...

View 2 Replies

Call On Onclient Event But Keeps Saying Function 'function Not Defined'

Dec 3, 2010

i got a javascript function that i want to call on <aspImabutton onclient event but it keep saying function not defined.

[Code]....

View 2 Replies

Web Forms :: Unable To Get The Label Text Into Public Shared Function

Jan 12, 2010

I am using the following code for slide show of AjaxToolkit. It works. But I wanna get the label1.text as picture name But I cannot do it in public shared function ! How can I do that !

[Code]....

View 6 Replies

Private Shared Vs Public Shared Vs Protected Shared

Jan 5, 2010

let me know what does these access modifiers means.private shared vs public shared vs protected shared

View 5 Replies

AJAX :: Get The Label.text In _Public Shared Function Resimler() As Slide()?

Jan 21, 2010

I have the following code for ajaxtoolkit slideshowextender's service method. I want to get the label1.text value to make the pictures diynamic. I hope you know what I mean. Bu I cannot ! here is my vb code;

[Code]....

I tired the below one but didn't work;

[Code]....

View 12 Replies

How To Override A Function And Call A Function With The Same Name From The Grandparent

Sep 6, 2010

I am attempting to inherit an ASP.NET RegularExpressionValidator and add some functionality to it. I inherited the control and added my custom properties. However, I would also like the client-side functionality to call a different JavaScript functionIn order to do that, I will need to supress what is happening in the AddAttributesToRender method because the name of the function is hard-coded there.

Protected Overrides Sub AddAttributesToRender(ByVal writer As HtmlTextWriter)
MyBase.AddAttributesToRender(writer)
If MyBase.RenderUplevel Then
Dim clientID As String = Me.ClientID
[code]...

View 1 Replies

Forms Data Controls :: Pass A Texbox.text To A Public Shared Function?

Jan 12, 2010

I have a gridview that is dynamically created and have finished all but one problem - I need for my code that is within a Public Shared Function to access a textbox string - In the below I need myinput to return the string so that my query's can use the variable - the below shows: Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

If I remove the "Shared" the error goes away however it crashes other parts. (if I hard code the text then all works as expected)

[Code]....

View 3 Replies

Forms Data Controls :: DataGrid's - Call A Server - Side Function On ItemDataBound Event Except Client - Side Function

Jan 10, 2010

I Getting A Problem In DataGrid's ItemDataBound Event. I Am Calling A JavaScript Function In DataGrid's ItemDataBound Which Retrun The CellIndex And RowIndex Number On Which UserClick After That I Am Re-Binding The DataGrid With jQuery Function After That ItemDataBound Event Not Working. I Want To Call The Same Function Again. Is Their Any Method To Call A Server-Side Function On ItemDataBound Event Except Client-Side Function..

View 4 Replies

Button Click Doesn't Call Function Even When Button Attribute OnClick Is Set To That Function

Mar 19, 2010

I have an aspx page with two buttons, one of the buttons has an OnClick attribute to a function that should be run when clicked. When the other button is clicked there is an if statement checking if the page is a postback, if it is then I run some statements that need to be run when that button is clicked. That postback button works fine. However, the other button, when it's clicked the function it's supposed to call never executes, and the statements inside if (Page.IsPostBack) get executed instead. What can I do to fix this? Is there a way to make the button that calls a function not do a Post back?

View 1 Replies

How To Write A Parameter For The Function

Feb 9, 2010

[Code]....

and I want to call this Button2_Click from my code, what should I write as parameters of this function?

View 3 Replies

JQuery :: Call Webservice With Parameter?

Sep 13, 2010

how to call web service with jquery in asp.net with param value

View 7 Replies

Call A Method In C# Determined By A Parameter?

Aug 24, 2010

I have a list of methods I wish to call and a button accompaning each and a generic method to handle the buttons.Using the commandArgument how can I run the selected method.E.g. Click run method1 button. In handler for button click call the method as named in commandArgument

View 4 Replies

Web Forms :: Use Function With Parameter On Page?

Aug 25, 2010

I'm trying to bind a function with Eval as parameter, here is my code snippet:

[Code]....

But It does not work, and the error: The best overloaded method match for 'Utils.Format_Gender(string)' has some invalid arguments

View 2 Replies

C# - Get Label Value As A Parameter Into A Javascript Function?

Jul 9, 2010

Hopefully this one is not too hard to understand but I just want the label values to be inputs into a javascript function. Might be better to explain with code: ASP.NET Label code:

<asp:Label ID="LabelCL" runat="server" Text="A single int filled in by DB"></asp:Label>

Page Source:

<span id="ctl00_cpMainContent_LabelCL">7</span>

What I would like to achieve but am not sure how to do:

<span id="ctl00_cpMainContent_LabelCL"> <script type="text/javascript">functionX(7)</script> </span>

So basically just wrap the output int in the following:

<script type="text/javascript">functionX( VALUE FROM LABEL TEXT)</script>
within the
<span></span>

View 4 Replies

Passing A String Parameter In A JavaScript Function On MVC

Jun 17, 2010

I tried to pass a string value into a JavaScript function like below: <%= "'" + prop.property_description + "'") %>) But it does not seems to be the best option, is there a better way to do the above without concatenate the string values with "'"?

View 2 Replies

AJAX :: Recover Parameter In Callback Function

Jan 15, 2011

I'm using ajax to call a webmethod from javascript. The call is successfully made to the webmethod but I'm not able to access the parameters I passed to the webmethod inside of the "OnSucceeded" callback method. I need access to those params because I need to perform more tasks on the client side when the webmethod returns. I'm assuming that the params are returned inside "usercontext", but the value of that param is "null" How can I have access to those params?

Here my sample code:

function OnSucceeded(result, usercontext , methodName)
{
alert( result + ' The value of usercontext is: ' + usercontext);
}
function OnFailed(error, userContext, methodName)
{
alert('Attempt to delete semantic attribute from page failed!');
}
function deleteSemanticAttribute()
{
var username = 'xxxxxx';
var password = 'yyyyyy'
PageMethods.GetMyData(username, password, OnSucceeded,OnFailed);
}
[WebMethod]
public static string GetMyData(string username, string password)
{
return "This is my test application!";
}

View 2 Replies

Procedure Or Function Expects Parameter Which Was Not Supplied?

Apr 7, 2010

Driving me mad on a personal project; I know I've done this before but elsewhere and don't have the code. As far as I can see, I'm setting the parameter, I'm setting its value, the connection is open, yet when I try to fill the dataset I get the error 'Procedure or function expects parameter "@test" which was not supplied'. (This is obviously a simplified test! Same error on this or the real, rather longer code though.)

C#:

SqlCommand l_oCmd;
DataSet l_oPage = new DataSet();
l_oCmd = new SqlCommand("usp_test", g_oConn);

[code]...

View 1 Replies







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