.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Ordinary function call (global.asa)

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

Hi, im hanging on a simple function call in my mainpage.aspx.vb. I want to get the physical server path to the Database1.mdb-file.

Dim strMypath As String
        strMypath = mypath()

then in my global.asax.vb I have this function:

Public Function mypath() As String
        mypath = ""
        Return Server.MapPath("/App_Data/Database1.mdb")
End Function

But this call doesnt work. I get a message in my mainpage.aspx.vb "The name "mypath" was not declarated."

Can anyone help???

View Complete Post

More Related Resource Links

databind from a custom function call


in datalist templatefield, i want to bind an imagebutton's visible property. the scenario is .. it is a picture comments page like one in facebook. if its your own comment, the delete button is shown, otherwise not.  the problem is .. for the imagebutton i want to set visible = false, if the user logged in is the same user as the one who commented. how can i do that ? please help

currently im using this code on datalist databind event. but the label is returned as null

public bool set_visibility()
        Label lb = DataList3.FindControl("Label7") as Label;

        if (lb.Text == Session["user_id"].ToString())
            return true;
            return false;

findcontrol dosent return the control.

how to call thickbox function in codebehind



i want to call thickbox.js function in codebehind , below the code in jquery

i want to call below code in codebehind

function tb_remove() {
    if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
        $("body","html").css({height: "auto", width: "auto"});
    document.onkeydown = "";
    document.onkeyup = "";
    return false;

Call function Vb in ASP

Does anyone know if is possible fill one column using a function in VB ? I thought in something like this but I don't know what i put in one part. Thanks.   <Columns> <asp:TemplateField HeaderText = "A" > <HeaderTemplate> <table> <tr> <td>Teste</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <asp:Label ID="lblTeste" runat="server" Text='<%# ???????? %>' /> </ItemTemplate> </asp:TemplateField>  

SSRS 2005 SP3 - Instr function with Global Variable fails in Subscriptions

Hi I have a very simple expression in a text box in my report:  INSTR(Globals!ReportServerUrl,"Report").  This expression should return the integer value of where the string "Report" appears in the Global variable for the ReportServerUrl.  Simple enough.  This works fine for generating the report directly through report manager, and in my case returns a value of 20. However when run as a subscription and emailed to myself the value returned is 0. This suggests that the search string does not appear in the Global variable. In the reportserver config file the URLroot tag contains the correct server address - http://myserver/reportserver. Does anyone know why i should be experiencing this issue with my subscriptions?  Your help would be much appreciated! Thanks Guy  Guy

Can you call a javascript function from code behind?

Call you cal a javascript function from the code behind? If so how??? 

Function in Global.asax is not running

Hi, I am using a Global.asax in on my webpage to run a function with an interval. In this test I have set the interval to 1 minute to be able to see what happens. I have declared a timer in the Application Start which should mean that when I open up the webpage after I have uploaded the Global.asax the timer will start.   However with this code below where I try to create a file named newFile.txt, this file is not created. I cant really understand what I could be missing. It seems that the function is not running ?<%@ Application Language="C#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Collections.Generic" %> <%@ Import Namespace="System.Linq" %> <%@ Import Namespace="System.Web" %> <%@ Import Namespace="System.Web.UI" %> <%@ Import Namespace="System.Web.UI.WebControls" %> <%@ Import Namespace="System.Drawing" %> <%@ Import Namespace="System.Net.Mail" %> <%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.Threading" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Text" %> <%@ Import Namespace="Microsoft.Win32" %> <%@ Import Namespace="System.Reflection" %> <%@ Impo

Can you call Javascript function from the codebehind?

 Can you call Javascript function from the codebehind?  How???

Call to "ChooseFont" API function fails

Hi all, I'm trying to call ChooseFont function in order to load standard system font dialog instead of .NET FontDialog (which does not support not TrueType fonts and fails with error if I try to choose such font). In C program there no problem to call to this function, but in C# the call fails with CDERR_STRUCTSIZE code (returned by call to CommDlgExtendedError). All structures sizes are equal to those in C declarations. Here is a code (maybe I miss something). Thank you in advance. private const int CF_SCREENFONTS = 0x00000001; private const int CF_EFFECTS = 0x00000100; private const int CF_INITTOLOGFONTSTRUCT = 0x00000040; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private struct LOGFONT { public int lfHeight; public int lfWidth; public int lfEscapement; public int lfOrientation; public int lfWeight; public byte lfItalic; public byte lfUnderline; public byte lfStrikeOut; public byte lfCharSet; public byte lfOutPrecision; public byte lfClipPrecision; public byte lfQuality; public byte lfPitchAndFamily; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = LF_FACESIZE)] public string lfFaceName; } //structure size in C is equal to 60, so I use int instead of IntPtr [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private struct CHOOSEFONT { public int lStructSize; public int hwndOwne

How to call an "instance" of script from a global script

I have this pretty standard JavaScript:Type.registerNamespace('XXXXwarners'); XXXXwarners.WarningValidator = function (element) { XXXXwarners.WarningValidator.initializeBase(this, [element]); } XXXXwarners.WarningValidator.prototype = { initialize: function () { XXXXwarners.WarningValidator.callBaseMethod(this, 'initialize'); }, validate: function () { // If the field is empty, we assume it's valid if (this._ControlToValidate.value.length == 0) { return true; } . . . . return true . . . return false } . . . } Which is getting attached to a number of Label controls using the standard script descriptor syntax.  The Javascript is behaving exactly as I would expect.  Now, I need to call the validate() function from elsewhere (I need to check all of the warnings that may be against any of the text boxes). So, I have an array which contains all of the ClientId entries for the behaviours.  I have tried this:$get(Page_Warnings[i]).validate() That tells me that the property or method validate is not supported.  So, I have also tried this:$find(Page_Warnings[i]).validate() In that case, the $find returns Undefined. Clues, please on how to find the function! Thanks, Nick        

Cannot call Table Valued Function from Dynamic stored procedure statement

Hello,  I have a table-valued function that splits string into a table column. I can easily call this function from a stored procedure within a regular SELECT statement: SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM [dbo].[fnSplitValues](@Code2String))   However when I try to use the same logic for a dynamic SELECT statement: ‘SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM ' + [dbo].[fnSplitValues](@Code2String) + ')’ I get an error ‘Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fnSplitValues", or the name is ambiguous.’ Any idea what is wrong with my dynamic SQL?   Please help, Lana

java script to call serverside function

hi i want java script by which i can call my asp.net (vb) function which i have written in aspx.vbi just using the vb function to change and check value of hiddenfild and other controln dont want to use ajax control toolkit , i wat to perform some action after spefic time interval

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

How to call javascript function in master page

helloi have javascript file 'script.js' where i have writt en a function for print. but this function is working fine if i am not using master page in my report page but the question is i want to use master page for my report page where i am calling javascript function but it is not working . Do help me regarding MasterPage and Javascript function.

asp:Button inside a SharePoint Dataview's Rows with onclick event does not call C# function. Pull i

asp:Button inside SharePoint Dataview Rows with onclick event does not call C# function. Pull it out of Dataview and works fine. I have a ASP.NET Button I've placed inside a SharePoint  DataView's rows with an onclick event pointing to C# function block inside my page. The page refreshes when I click on them, but it's not hitting that code block. If I move the button to outside the dataview and make the ID fixed, the code works beautifully. what's up with that? the button in the Dataview: td class="ms-vb" style="width: 70px"><asp:Button runat="server" Text="Delete" id="Delete{@ID}" CommandArgument="{@FileRef}" OnClick="DeleteDoc"/> </td> my C# onclick handler (inline C# on the page) void DeleteDoc(object sender, EventArgs e) { Button b = sender as Button; .. more code The buttons are rendered and they look like this: input type="submit" name="ctl00$PlaceHolderMain$g_08acadfd_957b_4112_a426_cc7c81991c1e$Delete1" value="Delete" id="ctl00_PlaceHolderMain_g_08acadfd_957b_4112_a426_cc7c81991c1e_Delete1" Thie code block in inline and I'm working from SharePoint Designer. Not sure how I can troubleshoot this.  Am I missing something here, maybe I need to add an Itemtemplate or something like we need to in the ASP.N

WCF function call in page load not working asynchronously

Hi all, I am trying to implement the WCF async function call in my page load event but, it not working asynchronously. Which means page content is displayed only after the asynchronous event is completed. This is my code         protected void Page_Load(object sender, EventArgs e)         {             if (!IsPostBack)             {                 ServiceReference1.Service1Client srv = new WebApplication1.ServiceReference1.Service1Client();                 srv.GetListCompleted += new EventHandler<WebApplication1.ServiceReference1.GetListCompletedEventArgs>(srv_GetListCompleted);                 srv.GetListAsync();             }         }           void srv_GetListCompleted(object sender, WebApplication1.ServiceReference1.GetListCompletedEventArgs e)         {         

The expression contains undefined function call MyUserFunction() error :Telerik Reports

  Hello All, I am getting the error."An error has occured while processing textbox:The expression contains undefined function call FormType()". I have a report..where in i used a user function called "FormType". My datasource  for teh report is sharepoint list. I am passing a parameter to the user function in the code.My user functions retrieves three values(one each time based on the conditions)But when i select the user function..in the edit expression dialog box.. i am not writing any parameter inside the user function as i am not sure what to write there. I have gone through http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx and thought i might fall in 2nd cateogry..but unable to find a solution for that Please help me. Here is the code. InitializeComponent();             string strType;             SPSite oSite = new SPSite("spsiteurl");             SPWeb oWeb = oSite.OpenWeb();             string[] parameters = { "10", "100", "1000" };             T

Asp.net MVC: How to call javascript function in Html.ActionLink

When I edit single recored in page, I use checkbox to get a selected row not every row with an actionlink element, but it seemed I cant make this way happen through calling javascript code(function GetSelectedRow() should return an id). Could anyone have a nice idea?<head runat="server"> <title>Index</title> <script type="text/javascript" language="javascript"> function GetSelectedRow() { var a = 0; var chkBoxes = document.getElementsByName("chkSelect"); var count = chkBoxes.length; for (var i = 0; i < count; i++) { if (chkBoxes[i].checked == true) a = chkBoxes[i].primaryKeyID; } return a; } </script> </head> <body> <div> <span style="width:20%"> <%: Html.ActionLink("Add", "Create")%> </span> <span> <%: Html.ActionLink("Edit", "Edit", new { id = GetSelectedRow()) %> </span> <span> <%: Html.ActionLink("Detial", "Details", new { id = GetSelectedRow() })%> </span> <span> <%: Html.ActionLink("Delete", "Delete", new { i
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend