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)
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 !
In my example below I am trying to Bind 2 different size GoogleAds to the 2 first rows in the GridView. One Ad on each row. The ads that are inside.......
(i2 == 0) and(i2 == 1).
I need to use <%if (Counts < 2) %> in HTML to restrict it to just 2 Rows, so this variable needs to be passed correctly also. As it is now, Counts is not passed correctly so <%if (Counts < 5) %> needs to be set in order to see any ads at all. I beleive this is because Page.DataBind() is binding the last ad in memory from the loop.
So when running this code, the same ad (i2== 2) is set to 3 rows in the GridView. This is my problem!
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;
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
I have the following code in a class in which I call from different pages, I wanted to know where this info is being stored at as I can see it from different pages.
[Code]....
Also, is this saved on the browser session? IIS? will whatever being set from 1 user be affected by every other user on the site?
We have an application that has quite an extensive APP_Code directory (about 150 functions). The functions are split across multiple files and then classes and namespaces.
On numerous pages we have to create numerous instances of the classes to be able to access the functionality, which can get very repetitive and means we're repeating code on every page declaring the instance etc.
As far as I can tell, a way to navigate this issue, is to make the functions Public Shared (as opposed to just Public functions).
For reasons I would rather not discuss, I need to create a custom authentication system for my app. I was just reviewing the system and am having some doubts if my solution is thread safe. My goal was to create a solution that would allow my app to authenticate a user one time and that users authentication info would be shared by all master pages, pages, classes, user controls, etc that are used. (But not share the same info between users) Here is my setup: PageHttpModule.cs - this is added to the web.config as a httpModule.
public class PageHttpModule : IHttpModule { public void Init(HttpApplication app) { app.AuthenticateRequest += new EventHandler(OnAuthenticateRequest); } public void OnAuthenticateRequest(Object s, EventArgs e) { CurrentUser.Initialize(); } public void Dispose() { } } CurrentUser.cs public static class CurrentUser { public static bool IsAuthenticated { get; private set; } public static string Email {get; set;} public static string RealName {get; set; public static string UserId {get; set;} public static void Initialize() { CurrentUser.AuthenticateUser(); } Note: this is a scaled down version of my authentication code. public static void AuthenticateUser() { UserAuthentication user = new UserAuthentication(); user.AuthenticateUser(); if (user.IsAuthenticated) { CurrentUser.IsAuthenticated = true; CurrentUser.UserId = user.UserId; CurrentUser.Email = user.Email; CurrentUser.RealName = user.RealName; } } } UserAuthentication.cs public class UserAuthentication { public string Email { get; set; } public string RealName { get; set; } public string UserId { get; set; } public bool IsAuthenticated { get; private set; } public UserAuthentication() { IsAuthenticated = false; Email = String.Empty; RealName = String.Empty; UserId = String.Empty; } public void AuthenticateUser() { //do some logic here.. if the user is ok then IsAuthenticated = true Email = address from db UserId = userid from db; Realname = name from db; } }
I have tested between 3 different browsers and it seems to work fine, but I am still learning and don't want to make a huge mistake. If my logic is totally wrong, then how should I do it so I dont have to put user lookups on every page directly?
I have a form with 4 multiline textboxes on it, however when user hits print button it only prints out what is on the screen and not entire contents of the textboxes. I have this javascript I created but it does not seem to be working..still will not print out entire content of texboes. On my Ascx page I am using the <div id="printdiv"> .
Basically, I have a gridview that is opened in a new window from the parent window. It has a bunch of records with a view button to view the details of each record (which stays in the same newly opened window). I have a calendar in the parent window that accepts a Date querystring parameter to set the current date on the calendar at page load. I'm just trying to refresh the calendar in the parent window to match the date of the label in the newly opened window. All the code below is in the newly opened window. The .Net code-behind below refers to when that view button is clicked and everything is populated. At the end, I call the js to refresh the parent window and pass the value of the LabelScheduleDate as the querystring parameter. Now the label comes through as '03/25/2010' in the code-behind, but when I pass it to the js, it comes through as '0.00005970149253731343' in the end querystring. I'm not really sure what is making the value change, and I want to pass it as just text. Do I need to pass it as a string object? I tried but I don't think I was doing it right.
JavaScript Function function RefreshParent(inputDate) { window.opener.location = window.opener.location + "?Date=" + inputDate; } .NET Code-Behind Protected Sub RadGridOnlineRequests_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridOnlineRequests.ItemCommand If e.CommandName = "ViewOnlineRequest" Then ' populates LabelScheduleDate among other controls values ScriptManager.RegisterStartupScript( _ Me, Me.GetType(), "clientScript", "RefreshParent(" & LabelScheduleDate.Text & ");", True) End If End Sub
i followed this link [URL] and i get selected value from dropdownlist using jquery
i created 3 partial views .
i need depend's on dropdownvalue redirect to partial page , so how can i implement in jquery with conditions?? or how can i implement in this function Public Function FetchData(ByVal dropdownValue As String) As ActionResult??
New Data.SqlClient.SqlConnection("ConnectionString")
Dim MSQL As New Data.SqlClient.SqlDataAdapter("SELECT Code, [Description] FROM [Dimension] where [Code] = '" & selrow.Cells(1).Text & "' ORDER BY [Line] ASC ", conLathv)
I am using a linkbutton iside a gridview.... i need to get the text of the link button in another function. how can get that ... i tried find control .. but its not working.... I created the link button from other function which executes just b4 this function...
I am new here, I was thinking about using a text box to function as a search box. For example, I key in the ID, the value will be searched in the SQL database and return other values in the same row. I was thinking of combining this with GRIDVIEW.
I m using textbox inside the gridview with 5 rows. when user click on submit button it should be display alert message if all 5 textbox field is empty "you cant submit message".If user any one of the textbox value he/she submit the data
customer_id items 123 pen 123 paper 456 pen 456 paper 678 pen
then i pivot the gridview by using the datatable.. i call the sql query to the datatable, pivot it using pivoted function and the datatable then become the datasource bind to the gridview..the result of pivoted datatable in gridview as below:
my question is..how can i replace the empty column with textbox to be display within the gridview??? i need to use textbox so that user may enter the value of the item within the textbox.. i try using the itemtemplate for gridview but it's doesn't work and the itemtemplate create new column with textbox beside the paper column.. how to input textbox within the datatable in my case??
On inserting record, I want to check that for example if a user enters a telephone number for any record is already in the database then it should validate that the number already exists in table and you cannot enter a duplicate value.
Then if user will provide some other telephone number then he allows to insert record.
For insertion of record I used ObjectdataSource.
User will enter telephone number in a simple textbox.
I may want to inform that I am working in asp.net2.0 and also not allowed to use any third party control or ajaxtoolkit.