VS 2010 / ByRef Not Working In A Routine In Code Behind?

Oct 18, 2012

I am writing a web application and one of the save routines calls another sub routine as passes two parameters byref. the sub routine gets the data required and assigns it to the passed parameters.

When I look at the results in the main sub the passed parameters are not set, why?

Here is my code:-

Code:
GetSiteDefaults(sqlDRCIC("CI_CLEANGROUP").ToString, sqlDRCIC("CI_CHECKGROUP").ToString)

Code:
Private Sub GetSiteDefaults(ByRef sCleanerCode As String, ByRef sCheckerCode As String)
Dim sqlDASites As SqlDataAdapter
Dim sqlDTSites As DataTable
Dim sqlDCData As New SqlConnection
sqlDCData.ConnectionString = conStringHQ.ConnectionString.ToString
sqlDCData.Open()

[code].....

View 4 Replies


Similar Messages:

VS 2010 UpdatePanel - Update Twice In Same Routine

Feb 4, 2011

I'm trying to do a number of large queries in the same routine, and have a label in an updatepanel update after each one. I must be doing something wrong, however, because whenever I fire up the routine, my label won't update until the last query is done. Isn't it possible to do UpdatePanel.Update multiple times in the same routine/event? This is the code I'm using:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
lblStatus.Text = "Busy with task 1"
UpdatePanel1.Update()
LongTask()
lblStatus.Text = "Busy doing task 2!"
UpdatePanel1.Update()
LongTask()
lblStatus.Text = "Done!"
UpdatePanel1.Update()
End Sub

Private Sub LongTask()
conn = New SqlConnection(connstring)
conn.Open()
cmd = New SqlCommand("Select * from very_large_table", conn)
cmd.CommandType = CommandType.Text
reader = cmd.ExecuteReader()
End Sub

When the form loads, the lblStatus is emtpy. When I click the button, I see the page loading until it displays 'Done!'. I don't see the other texts. This is the page source:

<%@ Page Language="VB"
MasterPageFile="~/MyApp.master"
AutoEventWireup="false"
CodeFile="test_page.aspx.vb"
EnableEventValidation="false"
Inherits="test_page"
title="MyApp"
Theme="DefaultTheme"
%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblStatus" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Update!" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

The page has a masterpage that contains the neccesary Scriptmanager.

View 1 Replies

Web Forms :: Want To Set The Initial Visible Property Of An Image To False And Then In My Code Change It To True And Then Run A Sub Routine?

Aug 10, 2010

Hi I have a situation where I want to set the initial visible property of an Image to False and then in my code change it to True and then run a sub routine. My problem is that no matter how I order the code the sub runs before the image becomes visible. When I debug the image only becomes visible when it hits End Sub. Is there any way around this? Here's my code:

[Code]....

View 4 Replies

State Management :: Object Is Byref And Shared?

Apr 14, 2010

I have a Session Varaible in which I am assinged a List of "MLoad" objects (Ex:- 10 MLoad objects) from the initial search. After that basing some icon click i am trying to get the new filtered results (Ex:- say 1 MLoad object) and assigning them to the public property "ListSearchResults" (See code below). When i do this the original results in the Session are changed(10 MLoad objects are getting replaced with 1 MLoad object ==> which just been filtered). What i have to do so that the "ListSearchResults" in Session is not changed. It is now byref, how to make it byval?

in acreate an object See below code and after retreving t

[Code]....

View 1 Replies

Web Forms :: Passing A Content Page ByRef To Helper Class - Can't Find Controls

Dec 17, 2010

Is there a way to pass a reference of a page to a helper class? Scenario: [ASP.NET 2.0 Web Application] The page is a content page which has a MasterPage. The page calls a method in the helper class and passes the page byRef as an argument. The method in the helper class tries to find a control on the passed in page and set values. Problem: Only the MasterPage is being exposed and not the page I am trying to pass. Any recommendations on passing the page so that I can set the values of the controls within it?

View 5 Replies

How To Get Code Coverage Working On A VS 2010 Project/Cannot Initialize The Project 'Project Name'

May 23, 2010

When I turn on Code Coverage in my test settings, on a project that references the Unity DI container I get the following error:

Cannot initialize the ASP.NET project'{Project Name}'.

The event log specifies the following reason:

Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified.

View 2 Replies

Web Forms :: How To Call A Routine From A Class

Apr 20, 2010

I have a web form with lots of code behind a button. I want to create a class, put all the code form the button into the class. But how do you call routines in the button from the class?

View 2 Replies

Routine For Stripping Off HTML Tags?

Mar 10, 2010

In my application, there's a module that displays a user's assignments. Sometimes these assignment descriptions are pretty long that's why I display up to 500 characters of the description. However, because I use an HTML editor in the app, if I blindly grab the first 500 characters, there's a good chance the description will look very funky due to missing HTML tags. So, I first need to strip off all the HTML tags, then grab the first 500 characters. Before I re-invent the wheel, I wanted to see if someone else has already tackled this issue and would be kind enough to share his/her code with me.

View 6 Replies

Pass GridView Cell Value To Sub Routine In VB.NET?

Feb 15, 2011

I have a GridView with Cell 0 containing the ID that I need to pass to a Public Sub.

I cannot figure out how to pick the value from Cell 0 in order to pass it to the Sub. I have tried experimenting (see the Dimmed EventID below) but have failed. Here is my code:

Protected Sub gvAppointmentsCalls_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvAppointmentsCalls.RowCommand
Dim EventID As String = gvAppointmentsCalls.Rows(e.RowIndex).Cells(0).Text
If e.CommandName = "gvAdd2Outlook" Then
Send_iCal_Call(EventID)
End If
End Sub

If I type the value directly e.g. Send_iCal_Call(123) then it works perfectly.

Public Sub Send_iCal_Call(ByRef Event_ID As Integer)
' My code in here
End Sub

View 2 Replies

Web Forms :: DynamicPopulateExtender And Function Routine?

May 1, 2010

My webform has 4 fields: Food Rent Utility subTotal

I'm using DynamicPopulateExtender for Food, Rent and Utility to update subTotal whenever there's a value enter.

Question #1: Do I use customScript or ServiceMethod that link to the function below

Protected Function UpdateSubtotal(ByVal nEntry As String) As Integer
Dim oldSubTotal = Eval("Subtotal")
'Bind("Subtotal") = oldSubTotal + Eval(nEntry) <--- I know Bind("Subtotal") don't work because Bind is not declared

End Function

Question #2: How do I update Subtotal value on the webform?

View 1 Replies

Web Forms :: Scheduling Timed Routine In Application_Start?

Aug 19, 2010

I'm looking at automating some reporting that I'm going to be generating. I want the reports to be generated and emailed at a particular time every day. These times will vary, and so will the types of reports.I was wondering if there were any better solution to creating a routine with a timer that executes at a set time every day? If I include this class and routine in the Application_Start of my Global.asax, will it always be running, or is there some awesome EventListener that I'm not aware of?

View 3 Replies

Configuration :: Application Is Working Fine In Local Environment But Not Working After Push Code In Live

Aug 19, 2010

My application is working fine in local environment but not working after push code in live. My locale environment and hosting environment both are having same configuration. Same app working fine 2 month before but in different domain but same hosting server.

how to check the both config / any possible to run debug mode in hosting server please let me know. below code used in all page for checking user session status but when I click on any link page redirect to login.aspx I think session got timeout. I don't know why session got time frequently, but this issue not happening in local environment (desktop).

[Code]....
[Code]....

View 6 Replies

Web Forms :: Code Write File 2.0 Is Working In Firefox But IE Not Working

Aug 28, 2010

If Not IsDBNull(ext) Then
ext = LCase(ext)
End If
Select Case ext
'Case ".htm", ".html"
' type = "text/HTML"
'Case ".txt"
' type = "text/plain"
'Case ".doc", ".rtf"
' type = "Application/msword"
'Case ".csv", ".xls"
' type = "Application/x-msexcel"........................

View 5 Replies

Web Forms :: How To Define OnClick Routine Of A Button When It Is Created In A Class

Aug 16, 2010

in .vb file, in a class i have created a button control, assigned its ID, and other properties.

In code behind file of a aspx page i have created object of that class.Run the page and browser Button control is coming. Now i want to do something in its click event.

But i am confused how to define that one, since presently there is no any button control instantiated.It is getting instantiated at the runtime.So, how to define its click event or any other events ?

View 5 Replies

Closing-routine / Close Connection Command After Getting Data From The Database?

Oct 4, 2010

I am using a adapted version ofhttp://www.mikesdotnetting.com/Article/45/Programmatically-accessing-data-from-DataSource-controlsDon't we need something like a closing-routine / close connection command after getting data from the database?If yes: What is the correct closing command?

View 2 Replies

Architecture :: Queue Events - Second Button Click Routine To Wait Until The First One Is Complete?

Oct 13, 2010

That doesn't make any sense at all but what I mean is, if you've got a button for example which takes say 10 seconds to complete whatever is in the button click routine, and somebody else on a different computer clicks the same button just after, is it possible for that second button click routine to wait until the first one is complete? And most importantly is it something fairly simple to do? I'm sure I accidently found some information on this when searching the web for something else but I can't remember what I was searching for before and can't find it now

View 7 Replies

VS 2010 - StyleSheet Not Working When Publishing

Mar 2, 2012

In the page element of my Style sheet, I have the width set to 1100 pixels. In VS, it works perfectly. When I debug it, no problem. But when I publish it to IIS, it reverts back to the default... 960 I think.

CSS Code:
.page{    width: 1100px;    background-color: #fff;    margin: 20px auto 0px auto;    border: 1px solid #496077;}

View 3 Replies

VS 2010 - Maxlength For TextBox Not Working

Jun 20, 2012

If I set the maxlength field for a textbox, and have the textmode set to SingleLine, the amount of text is limited to the specified number of characters. If you change TextMode to MultiLine, the number of characters is no longer constrained.

View 2 Replies

VS 2010 - Interface To Web Service Isn't Working

Dec 20, 2011

I wrote a web service for a co-worker. The web service is in VB.NET, and it works fine for me. When I write a consumer and walk-through it, it returns me the correct data, and when I run the URL in a browser, the methods are exposed to me.

My co-worker wants to call this web service using JSON. He is debugging it in Firefox with Firebug. He gets a pop-up entitled "Authentication Required" and it says Enter username and password for <the URL> of the website (under which the folder of my webservice has been defined as an application in IIS), and there's a textbox for an id and password. Firebug says 401 unauthorized.

I am developer, not a SA, so I don't understand a lot of the hits I am getting when I google this error. I did change one thing in IIS, though. We have another web app on another server where we've employed the exact same model, and that web service works. So I am trying to compare the two. I changed Authentication so that Anonymous Authentication was Enabled and the others were Disabled. I was hopeful this would work, especially because Basic Authentication and Windows Authentication's Response Type were HTTP 401 Challenge, but that did not work, unless I need to restart something (do I?).

View 1 Replies

Visual Studio :: Intellisense Not Working In 2010?

Apr 14, 2010

As I wanted to try out the new VS, I started and began working on a C# web project that I had previously started in VS2008. So far, so good. But then I noticed that Intellisense is not working at all. I have done some searching, but all I could find were some problems with the release candidate version crashing.Does anyone have any insight as to what might be causing this and how to resolve it?

View 3 Replies

Visual Studio :: 2010 Project Not Working In Iis?

Mar 19, 2010

i get this error.What should i do ?

I even tried webapplication setup project is it not ready to deploy with RC ?

<compilation debug="true" targetFramework="4.0">

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately. Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

View 2 Replies

VS 2010 Access Control Only Working For ASPX

Oct 2, 2012

I have created an access rule for my website, it looks like it works fine when trying to access .aspx files, but not for any other extensions. I was wondering if there is trick to apply the access rule for all files types.

Code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authorization>

[URL] ....

I tried to add the following code to my main config file but still will only work for .aspx only

Code:
<modules>
<add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />
<remove name="UrlAuthorization" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<remove name="DefaultAuthentication" />
<add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" />
</modules>

View 7 Replies

VS 2010 - Entity Framework Not Working As Expected

Sep 24, 2012

On my underlying DB I have 3 tables. 1 of those tables comprises of just the primary keys of the other 2 tables. When I built the Model, it recognised this and so didn't actually generate an entity for this table, but instead made a many to many relationship between the other 2 tables.Now when I save changes against the context. (new records) under the hood the table with just primary keys are not populated. How do I get this table populated?

View 4 Replies

VS 2010 / Crystal Report Not Working After Publish?

Mar 21, 2015

I have VISUAL STUDIO 2010, c#, with mysql database, i installed crystal report for visual studio.

all are working in the debugging mode in vs 2010 flow list is.

1. enter an id number in the textbox

2. after pressing the generate button , value of the textbox will be converted as a parameter of the crystal report

3. It shows the information of that i.d from the database.

[URL]

View 1 Replies

Moving The Javascript Code To Design View Is Not Working. Only Code-behind Attributes.Add ("onclick" Works. Puzzled

Jul 15, 2010

I wanted to disable a button after it is clicked and at the same time fire the post back event to generate a report. My first set of code did not work because soon after the button is disabled the page won't submit/post back. here's the first set of code which was not implemented. the onclientclick calls a javascript function which has these lines

document.getElementById('btnGenerateReport').disabled=true;
GetPostBackEventReference(btnGenerateReport,'');

since it was not posting back,i tried the following on page_load code behind

btnGenerateReport.Attributes.Add("onclick", "this.disabled=true;" + ClientScript.GetPostBackEventReference(btnGenerateReport, ""))

that worked well. but I tried to copy the javascript that got generated and pasted directly on design view

onclick="this.disabled=true;__doPostBack('btnDownloadClientsWithConviction','');"

its not working from client side alone after I disable the code behind attributes.add
but when I check the view source the 2 pages are the samewhy am I not able to move the code from code-behind to design view?

View 1 Replies







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