C# - Transfer Two Variables Between Three Methods?

Mar 31, 2011

How would I go about sending a int variable, and string variable from one method to another method, to a final third method? This is basically how I have my methods setup. Obviously there is code that runs in each of these, but I am just trying to understand how to transfer these variables to my other methods.

protected void deleteOkBtn_Click(object sender, EventArgs e)
{
remove()
}
protected void imgdelbtn_Click(object sender, EventArgs e)
{
}
public void remove()
{
}

View 3 Replies


Similar Messages:

C# - Is It Safe To Use Server.Transfer() To Transfer A Request To A Static Image (.jpg - .png)?

Feb 8, 2011

I have a class which implements IHttpHandler that is designed to handle image resize requests. It handles Urls like so [URL] Currently the handler looks for myimg.jpg on disk, cuts a 100x100 thumbnail (if it isn't already present) and redirects the client to the thumbnail like so Response.RedirectPermanent("/some/virtualPath/to/thumbnail.jpg");

This has been working great, but I would like to avoid forcing the client to issue a second HTTP request. Is it safe to do the following? Server.Transfer("/some/virtualPath/to/thumbnail.jpg") All the MSDN documentation talks about using Server.Transfer() to redirect to an aspx page, so I'm not sure if this is the right thing to do or not.

View 1 Replies

Using Extension Methods In Static Methods On Extended Classes?

Aug 16, 2010

I have an extension method as follows:

public static class PageExtensions
{
public static int GetUserId(this Page targetPage)
{
var user = Membership.GetUser(targetPage.User.Identity.Name);
return (int)user.ProviderUserKey;
}
}

Now in a page I need to use this method in a static WebMethod, so I have added another 'extension method' to PageExtensions:

public static int GetUserId()
{
return (int)Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;
}

and I call it as follows in my WebMethod: PageExtensions.GetUserId()

View 1 Replies

Web Forms :: How To Change This Methods In To Use Dictionary Or Extension Methods

Jul 23, 2010

public class CacheHelper { /// <summary> /// Removes object with the specified key. /// </summary> /// <param name="key">The key.</param> [code]....

I have this methods for caching..I need to change this methods to use in aDictionary<string,object>

How do I need to change this code Because I am new to asp.net I am still learning..

View 12 Replies

Collect 2 Variables From One Hyperlink, And Use Those Variables In The Page_load To Set As Session?

Aug 8, 2010

i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables

such :

<a href="javascript:;" onclick="wsChangeColor('mainData', '#FF0000','#FFE4E1');return false;" title="Change color" id="red">1</a>

i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?

View 1 Replies

Web Forms :: Storing Javascript Variables Into C# Variables

Jan 2, 2010

I have this code in javascript: var x = e.mapX; It gets the X-coordinate of a map. What I want to do is that I want to store this into a c# variable. I have a class named Test with an integer property X. I want to store var x into X. In the codebehind, I have this on the Page_Load: Test test = new Test(); Then I am trying this on the javascript code: var x = e.mapX;

View 16 Replies

Security :: Not Extending MembershipProvider Class And Putting All This Methods In Some Unique Class And Call Its Methods Then?

Sep 16, 2010

I am beginner in web applications development. I started one little project and host it on source forge "https://homoco.svn.sourceforge.net/svnroot/homoco". And I started implementing authentication in this application to learn how it works. From my experience people never use out of the box things so I want to implement this stuff alone (like in real world projects). So some questions:

1) Is there any reason to use membership out of the box? To use database table schema, stored procedures etc. that tool generate for developer. I think that this lower control over code and I decided to implement it my self. I don't know if I am right.

2) Is my approach in this demo project good or bad (if someone have time I like to do just a little code review)? I created database based on business rules. Not using database schema that membership provider require. Extend "MembershipProvider" class to satisfy my needs. Implement queries to database myself.

3) Now, this question is a little wired but I have to ask it. If we make custom Membership Provider and do sql queries alone, implement all MembershipProvider class methods ourselves, and in application use Membership.blabla() why is this approach different from not extending MembershipProvider class and putting all this methods in some unique class and call its methods then? I hope that someone understand what I ask here.

I am sorry for three questions, but I really trying to find the best way to implement this feature in my demo project like it is a real world application.

View 3 Replies

Working With Static Variables / Store The User Specific Information In Static Variables?

Mar 5, 2011

whats the exact use of static variables in overall programming in .net and for asp.net...

Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..

whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.

View 3 Replies

MVC :: Can Call The Methods Inside The Controller And Inside The Models "Action Methods"

Mar 21, 2011

i have a repository class inside my model folder; this repositiry contains many methods , which are called from Action methods in the controllers; so my question is :- if i have a method insidle my model.reporsitory which calls a stored procedure, then can i call it an "action method"? or "action method" expression only apply to controller methods?

View 4 Replies

"GroupBy" And "OrderBy" Methods From LINQ As Extension Methods?

Mar 11, 2010

We say that "GroupBy" and "OrderBy" methods from LINQ as Extension Methods.Then how about "variable.ToString()" and "string.Split()" menthods. Are these Extension methods.

View 2 Replies

Transfer Value From One Page To Other?

Jan 10, 2011

list out all the ways in which value can be passed from one way to another and a quick example for each.

server transfer
response redirect
sessions
cookies

View 12 Replies

Transfer Mails Automatically?

Sep 2, 2010

i have collection of mails with subject ,and i all the mails should be transfered to the realted dept as according to the subject in emails ?

View 10 Replies

Prevent Transfer Of Session?

Dec 13, 2010

Does somebody now a good way to make session not transferable, so an user can't move/copy the session token ID from one machine to another?

View 2 Replies

How To Transfer Data To Another Page

Mar 26, 2010

how do I transfer my data to another page.

Have 3 textbox whose value must be transferred..

View 5 Replies

C# - Transfer Data In Another Gridview

Jan 16, 2011

I have a gridview with these columns: id,name,price,quantity,total. Also i have a button and checkbox in every row of gridview. When i check some rows i would like these rows with the button to transfer in another gridview.How can i do that?

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="id" DataSourceID="SqlDataSource3">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:HiddenField ID="hdValue" runat="server" Value='<%#Eval("ID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"
ReadOnly="True" SortExpression="id" />
<asp:BoundField DataField="name" HeaderText="name" ReadOnly="True"
SortExpression="name" />
<asp:BoundField DataField="price" DataFormatString="{0:c}" HeaderText="price"
ReadOnly="True" SortExpression="price" />
<asp:BoundField DataField="quantity" HeaderText="quantity"
SortExpression="quantity" />
<asp:BoundField DataField="total" DataFormatString="{0:c}" HeaderText="total"
ReadOnly="True" SortExpression="total" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Land]"></asp:SqlDataSource>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>

View 1 Replies

Transfer Files With Ftp With Ftpwebrequest?

May 26, 2010

currently I'm working on this ftp transfer. [URL]

I have setup my server computers iis to have a ftp site on port 21 and transfering files works great. But I want to add ftp to a hosted site I got on the server and it's here where I get the problems with connecting. when I try to connect through the command promt I get unknown host error. I have changed the port and open it up in firewall. and even if I could connect how can I decide what folder I want to upload to?

View 3 Replies

Use Redirect Or Go With Server.Transfer?

Jun 19, 2010

If I need to redirect a user from one page to another, should I use redirect or go with server.transfer? I'm assuming redirect. The idea is to give the users one specific URL and then have that URL redirect to the most current iteration of the page. For example, the user may have [URL] as the URL but the actual page served to them would be [URL]

View 16 Replies

Transfer A Value From Listbox To Textbox?

Apr 8, 2010

I have a listbox control that is databound to a dropdownlist, so when the user selects a value from the dropdownlist, the listbox then displays the corresponding value from the database.

What I now want to do is have the value of the listbox automatically populate another texbox that is databound to something else.

I cant get this to work using the DropDownList_selectedChanged event.

View 3 Replies

Transfer An Object Between Two C# Apps Over The Web?

Jun 15, 2010

I have written an application that basically gathers up a bunch of text and numerical data from the client PC and stores it as an object. Right now I'm implementing XML serialization so that the file can be saved.

The issue is now, how do I get this data to the server? I have a server running IIS 7 setup but I don't quite understand the ASP.net life cycle, so I'm not sure how to implement the receiving app.

View 5 Replies

Web Forms :: Server.Transfer Again?

Mar 25, 2010

protected void btnCancel_Click(object sender, EventArgs e)
{
Server.Transfer("Fix_Details.aspx");
}

Server.Transfer is not redirecting the page. It stays on the page that the button was clicked on. The message is "Error on Page."I tried Response.Redirect and that didn't work either.

View 5 Replies

Web Forms :: Can Data Transfer Between 2 Web Applications

Sep 10, 2010

how can data be transfered between 2 web applications runnig on 2 web servers

View 4 Replies

Exception Handling In Server.transfer

Feb 26, 2011

A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code

After banging my head because i could find where the exception came for and global.asax didn't get hit i found that it's from server.transfer and is a known bug. The alternative i read about is server.execute.However if i do this then the next page fires multiple javascript exceptions and a gridview i have is breaking of and the rows appear half at the left page corner and half inside the gridview!!

For now i just put a try catch on the server.transfer although the exception will not affect the application even if i don't use try catch. I also see that the exception is happening again even if i put try catch but with different dll: A first chance exception of type 'System.Threading.ThreadAbortException' occurred in App_Web_benglxq1.dll An exception of type 'System.Threading.ThreadAbortException' occurred in App_Web_benglxq1.dll but was not handled in user code Now what on earth is benglxq1.dll i don't know. What i know is that i'm leaving an exception to run and i don't like that. This is the js error when i use server.transfer btw: Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys._Application'.

View 8 Replies

How To Transfer Login Info From One Server To Another

Nov 24, 2010

I have one website running on one server and another web application running on another server. My web application asks for username/password to login into the system. I need to put a username/password field on my website so that user can directly login from website. how to transfer these username/password values to the web application running on another server?

View 3 Replies

How To Transfer Data From A Gridview To A Database

Jan 18, 2011

I have this code

private void BindSecondaryGrid()
{
DataTable dt = (DataTable)ViewState["SelectedRecords1"];
gridview3.DataSource = dt;
gridview3.DataBind();
}

The selected records from the gridview2 are saved there ViewState["SelectedRecords1"].The columns are id, name, quantity, total. Then these records are saved in gridview3 with

gridview3.DataSource = dt;
gridview3.DataBind();


Now i would like to get these values from gridview3 and store them in a table in my database with same columns of course.Is there a way to do that?

View 1 Replies

C# - Server.Transfer In Global.asax?

Dec 29, 2010

I have a custom error handler in the global.asax's Application_Error method, when an error occurs I use the following code to transfer user to the error page:Server.Transfer("/Error/");

However without specifying the actual page name the code above breaks with "Error executing child request for /Error/" exception.So if I use Server.Transfer("/Error/Default.aspx") it works fine with no problems.Also using Response.Redirect("/Error/") works fine too, however we want to keep using Server.Transfer to retain URL displayed in the address bar when the error page is displayed so users can simply refresh the page to retry accessing the original offending URL.Would be grateful if anyone can comment on how to get the Server.Transfer method working without specifying the actual aspx page name.

View 1 Replies







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