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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Access Public Function in MasterPage

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :ASP.Net
 
Hi,I need help in accessing the function in my masterpage.I have a.master and b.aspx with the content page.Now in the page load of my content page, I want to execute the an sql query which is in a function in my master page.How can I access the function in my master page??code in my master page:public function info () as string'SQL Queryend function


View Complete Post


More Related Resource Links

Cannot access public methods on MasterPage

  
Hi All, maybe someone can help me with this one. I have a a public method in my code behind on the site.master pagenamespace PROJECT { public partial class Site : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { } public void applyUserRole(string userID) { } } } I  wish to call applyUserRole() from Default.aspx On Default.aspx I have .. <%@ Page Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Project- Home" %> <%@ MasterType virtualPath="~/Site.master" %> But when I go to Default.aspx.cs and type Master. the method is not appearing. I've seen other post where people are having this issue but I can't find an answer. If anyone has any good pointer and you please let me know, thanks 

Public Shared function doubt????

  
Hi
I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

I am confused here. Is it the right way to go?

Please advice. Thanks in advance.

Pankaj

Error "The process cannot access the file ....." occurs while using function "ExportToStream"

  

Dear all,

   I sometimes get the following error while printing crystal report to pdf:

   System.Runtime.InteropServices.COMException (0x80004005): The process cannot access the file because
it is being used by another process. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export
(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream
(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
 at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at
 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at
 CommonWA.CommonFunc.GetPDFMemoryStream(DCMSReportDoc _dcmsreportdoc, Boolean& _DataExist) in E:\wwwroot\ASPWA\CommonWA\CommonCom.vb:line 382

  The error not occurs frequently but sometimes it will happen, can someone tell me why the error occurs and how can I solve the problem?

Thank you very much.

Ray


Access UserControl Control from a JavaScript Function

  
I have a requirement to launch a Modal Javascript dialog box from within my usercontrol,I have done this by <code> function browseControlAction(ProjID,ControlID) { strPrompt = 'Select a Previous control action..'; strOptions = 'dialogWidth:25;dialogHeight:30;status:no;resizable:yes'; selectedAction = window.showModalDialog('browseControlActions.aspx?ProjID=' + ProjID + '&Control=' + ControlID, strPrompt, strOptions); var sControl = ' + ControlID + '; if (selectedAction != null) { alert(ControlID.toString()); alert(selectedAction); var sTest = ControlID + '_txtControlAction'; alert(sTest); var sTest2 = 'txtSummary'; alert(sTest2); document.getElementById('txtCurrentControls').innerText=selectedAction;   //this works as this a control on the page itself document.getElementById(sTest2).innerText=selectedAction;      //Ditto document.getElementById(sTest).innerText=selectedAction;    //This Fails as this is the control in the USercontrol I am trying to Access //__doPostBack('',''); }</code>can anybody tell me why I can't access the Textbox control on the USercontrol?

Equivalent C# function for this random access read for this VB6 function?

  
I'm having a problem reading a block of bytes into an array from a file read (random access).  Instead, in C#, it seems I can only read byte by byte and not a block of byte.  I want to create a string array that is 500 cells in capacity but each cell is 10 bytes wide.  how do i do this?I have  written the function in Vb6 and maybe someone can tell me the fs.Read (code) for the C# equivalent.In Vb6, I declaredPrvate Type WFM  points(500) as String * 10   // This will create an string array of 500 cells but the KEY here is each cell is 10 bytes wide fixed!End type

SQL Equivalent to the First Function in MS Access

  
Is there a sol'n?  I have looked all over the net and have not been able to find a thing.Here is copy Access code..SELECT ID, [Academic Year], Term, Location, [Student Section], [Creation Date], First(Date) AS FirstOfDate, First(Status) AS FirstOfStatus, First([Reg Status]) AS [FirstOfReg Status], First([Status Date]) AS [FirstOfStatus date] INTO [TEMPDB]FROM [StudentRecord]GROUP BY ID, [Academic Year], Term, Location, [Student Section], [Creation Date]ORDER BY ID, [Academic Year], Term, Location, [Student Section], [Creation Date], First(Date) DESC , First(Status) DESC;I hope this helps.

access control from masterpage

  
How do I get access to the below linkButton control from my Master page or a page using that Master, this is in my Master page:<Project:RoleControl ID="RoleControl1" runat="server"> <AdminTemplate> <li id="liadmin" runat="server"><asp:LinkButton id="lnkAdmin" PostBackUrl="~/admin/admin.aspx" runat="server" CausesValidation="false">Admin</asp:LinkButton></li> </AdminTemplate> </ Project:RoleControl> Basically it's a custom control I built which will allow me to show certain things only to admin users, we are not using asp.net membership so I came up with a control that works. But when I try to access it within the Master page itself it keeps saying the control has 0 count in it, I'm doing this check in the Page_Load event:if (RoleControl1.Controls.Count > 0) { string roleControlId = RoleControl1.Controls[0].ID; ((HtmlGenericControl)RoleControl1.FindControl(roleControlId)).Attributes["class"] = "navselected"; } But the RoleControl1.Controls.Count check is always 0. I know the control is rendering as I can see it when the page loads, the link comes up. I thought maybe I'm checking it in the incorrect event, rather than Page_Load should I be checking for it in another event, could it be that at that point

Public Access to Reports

  

I'm designing some reports to summarize recently compiled research findings.  These reports are going to be posted on an ASP.NET page (via the report control) on the web site.  I do not want to authenticate users, as the findings are meant to be public and requiring users to register and authenticate would add a barrier and is likely to decrease traffic.

I've seen similar posts where reports are meant to be viewed by everyone on an intranet and permissions could be set using a designated workgroup.  I need alternative solutions to the problem of making a report viewable by everyone who visits a site.  I'm also currently unfamiliar with Kerberos (and I know that will probably pop up as a potential solution), so if there's a convenient way outside of that it would be great.


Public Access to SSRS Reports

  

I'm designing some reports to summarize recently compiled research findings.  These reports are going to be posted on an ASP.NET page (via the report control) on the web site.  I do not want to authenticate users, as the findings are meant to be public and requiring users to register and authenticate would add a barrier and is likely to decrease traffic.

I've seen similar posts where reports are meant to be viewed by everyone on an intranet and permissions could be set using a designated workgroup.  I need alternative solutions to the problem of making a report viewable by everyone who visits a site.  I'm also currently unfamiliar with Kerberos (and I know that will probably pop up as a potential solution), so if there's a convenient way outside of that it would be great.


Use a WPF control in a Public Shared function

  

Hello,

I am trying to write a program that uses a button on one window to alter a control in another window.  I have a Public Shared Sub declaration in the window I wish to alter, but I cannot put in the code to make the changes to the control (error is "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").  How can I get around this so I can change a control's properties from within a Public Shared function?

Thanks!


Passing variable into function in SQL Server from Access

  

Hi, 

I am trying to call a function in SQL Server 2005 from Access 2003.  It works fine with the constant value, but fails with a variable of the same value.  This works:

strSQL = "SELECT * FROM functionName (constantValue)"
rs.Open strSQL, cn 

But when I use variable in the parameter, I get error.  I have tried creating parameter objects in Access, but couldn't execute it and don't know if this is a way to go anyway.

Would appreciate for any help or suggestion.

 

Thank you


Public Function Testing (ByVal FirstString as String, ByVal FirstInteger as Integer), how to pass a

  

I have the following function, sometimes I want to pass a DBNULL.Value to the function so I update the database with a null value, but it won't let me as the DBNULL.Value is not a string or an integer, how can I get this to work?


Public Function Testing (ByVal FirstString as String, ByVal FirstInteger as Integer), how to pass a DBNULL.Value?

' update database

Return value

End Function





How to call a Public function of a window from another Window in WPF

  

How to call a Public function of a Mainwindow from another Window in wpf using VB.Net?

I checked this thread and tried to implement similar way as follows

1. Created an instance for the main window and declared a public function

Public Interface IMainWindow

 Function Show_Tickets(ByVal p_Para As String) As Boolean

End Interface

2. In the Mainwindow

at Initialization part

Class MainWindow

 Implements IMainWindow

3. Implemented the Function

Public Function Show_Tickets(ByVal p_status As String) As Boolean

Public Function / Sub with multiple options

  

You know how the built in functions in VB.NET gives you the option to pass 1 parameter, 2, 3, or 4 all within 1 function, how do they do that? and when the intellesense comes out, there is a "1 of 4" on the top left of the intellesense and you can click to change and see what the other 4 options are.


How to use sql insert and left function is ms Access VBA module

  

I have table called main table and there is 2 columns in it "Department name" and "DeptID" Dept name column has values such as

DP302-Finance and DeptID column is empty. i want to write sql insert statement that will just select first 5 characters from Department name and insert into DeptID. for e.g DP302-Finance in Deptarment name should be copied into DeptID columns as DP302. I am using following sql in access module but i am getting synatx error in insert into statement.

Sub che()
Dim objDB As DAO.Database
Dim strsql As String
strsql = "insert into main .(DeptID) (select left [Department name, 5]as DeptId from main)"
Set objDB = CurrentDb()
  objDB.Execute strsql, dbFailOnError
  Set objDB = Nothing
End Sub


Restrict public access to webservice

  

I have this Internet web service page(webservice.asmx) being consumed jquery ajax call.

And I am hoping to restrict public request to this webservice other than request from local pages (aspx or jquery ajax call).

The web service checks for form-authentication before it gets executed but I just don't feel comfortable the .asmx page and list of services are viewable.

So users can't just type www.mysite.com/webservice.asmx to access my webservice. 

I'd appreciate any advice about securing web service.



ASP.NET MVC: Using NonActionAttribute to restrict access to public methods of controller

  
 

Public non-action methods in ASP.NET MVC controllers are source of problems because they can be called by user when not handled carefully. Same time you may need public methods on controllers for some other reasons (some UI framework, testability problems, things you cannot change etc). In this posting I will show you how to handle controller methods properly.

Calling controller methods

Public methods of controller are called controller actions and these actions are mapped to URL-s using routes. Take a look at the following code.


public Acti
Categories: 
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