How To Write Functions And Methods In C Sharp
Mar 15, 2011how to write functions and methods in c sharp?Is it not possible to write function in c sharp if not if i want return some value then how should i execute this
View 6 Replieshow to write functions and methods in c sharp?Is it not possible to write function in c sharp if not if i want return some value then how should i execute this
View 6 Replieshow can we create Passing Arrays to Methods inc sharp
View 4 Repliesyes client side must be java script but my qustion is not that.i am asking that can i use c# language to implement "actions" fired on "click side events" such as mouse over the reason for this question is that i remember some syntax of registering functions for particular events of formview, which are call when the event occurs (yes there ispostback involved" is something like the above possible for client side events using c# or even vb.net
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "this is label three";
Label3.Attributes.Add("OnMouseOver", "testmouseover()");
}
protected void testmouseover()
{
Label4.Text = "this is label 4 mouse is working!!";
}
I would like to write a function to reuse some functionality that I repeat over and over...
For example:
[code]....
What's changing, in every field, is only the lambda function to get the current field to edit (Name, City, Address, etc...).
What is the best method? Or better: is there ANY method to extract a generic function?
I've written the following Extension Method
<Extension()>
Public Function ToUtcIso8601(ByVal dt As Date) As String
Return String.Format("{0:s}Z", dt)
End Function
But I also need a Nullable version of the same method... how exactly do I do this?
This is what I was thinking, but I'm not sure if this is the right way
[code]....
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()
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..
which is the better language in terms of coding, proficieny if we compare between VB.Net and C Sharp.
View 7 RepliesWhat does the underscore mean in C Sharp?
I saw a program,
Csharp Code:
Class Metals {string _metalType;public Metals(string type){_metalType = type;Console.WriteLine("Metal: " + _metalType);}}
What does the _ (underscore) mean in it?
Does that mean any static variable or something else?
I am unable to show message using msgbox.show method in c sharp which we can use in Vb.net.
How to implement such thing in c sharp
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.
What is partial class in c sharp and whats the use of it, how to implement the partial class
View 6 RepliesMy project is completely built on asp.net with codebehind vb.net, is it possible to add a class library .cs file to my project. since it is based on c sharp will i be able to add it.
View 2 RepliesHow to generate a sequence like the follwoing
AAA
AAB
AAC
.
.
.
ZZZ
I want to store it in a database as a column.
I am new to asp.net c sharp; right now I am working on one project, in that I need to send the [short message service] to mobiles, I don't how to send the message to mobile. Please someone help me, give some ideas or some links where I can find the sample code or sample projects
View 6 Repliesgive me any pointers for free tutorial on RADGRID or give me a simple example on how to create a RADGRID and bind it to data source.
View 2 RepliesI want to select data from SqlDataSource tag to gridview using TextBox1 value.how can i modify that ASP.net code behind file..
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand= "select distinct [Species],[qty],[received],[Discard],[mortility],[dispatch],[dispatch],[dpt_sales] from [vw_getFishDtls] where [Tank_id]=TextBox1.Text and [ftype] =(select [ftype] from [vw_getFishType] where [Tank_id]=TextBox1.Text"
ConnectionString="Data Source=IT-ISHAN;Initial Catalog=ETF;User Id=ishanuk77; Password=ishanuk77;">
</asp:SqlDataSource>
i am writing a simple C# application with sql as my database however i am confused how to connect to my database the details are the following:
Server = "BFO-PC3\BFOPC3SQL2000";
Username = "aesadmin";
Password = "adminpw";
Database = "M4200";
i have extracted data from database..currently that information is in a string variable...my point is to pass that string value into a gridview in the application..i have already created the gridview with checkbox list fitted into it...on inserting the values will the gridview will expand dynamically ??..if no then what to do ? how to push the data into gridview so that it expands dynamically?
View 1 RepliesHow to convert list to dataset using c sharp?
View 2 RepliesI have a MVC project where NHibernate + SharpArch are being used for data persistance across the project. The properties class for the database are created then I have my repositories bringing back data using LINQ. However, for some recent queries I have done I am getting the following error;
[Code]....
There is no column in my database with name PaymentRefundFkFk so what maybe causing this and how do I resolve this issue?????
I am looking to learn .NET , i have experience in some Html, Php and mysql . What i mainly need to know is where to start.-I am guessing i would use Microsoft visual studio for development , and design of my pages.-If i wanted to make a site that ran a compiled program for instance, what would be the best langauges to learn alongside .NET c-sharp ?-Is it mysql compatible? Just looking for the best place to start.
View 2 RepliesIn my website I have two files home.aspx and tab.aspx with code behind files home.aspx.cs and tab.aspx.cs. I have a table variable in tab.aspx.cs which needs to be sent to home.aspx.cs when I click a button on home.aspx.
View 1 Repliesi'm using Asp.net MVC with Sharp Architecture.
I have this code:
return _repositoryKeyWord.FindAll(x => x.Category.Id == idCAtegory)
.Take(50).ToList();
How can i order by random?
Note: i don't want to order the 50 extracted items, i want order before and then extract 50 items.
m building a web-page in that theres a tag which holds some documentary data, so i want to print that specific data and not the whole page i.e banner, textfeilds etc... since i know window.print() function prints the whole page, but how to print a sepicific area in a page.
View 2 Replies