Click here to Skip to main content
15,885,707 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to call void function (Non Static Method) in Static Method....

I have a function named drawmenu after saving by json(webmethod c#) it should be called...how is it possible ?? i want to refresh my menu list after saving without post back ....

Thanks

void drawMenu()
{
int i = 0;
string InnerHTML = "";
string str = select query
SqlDataAdapter sqladp = new SqlDataAdapter(str, Conn);
DataTable dt = new DataTable();
sqladp.Fill(dt);
for (i = 0; i < dt.Rows.Count; i++)
{
InnerHTML = my query data
}
divmenu.InnerHtml = InnerHTML;
}

DivMenu is my Div ...

[WebMethod]
public static string Update(string CAT_ID, string CAT_NAME, string DESCRIPTION, string PID)
{
var UID = int.Parse(CAT_ID);
var UPID = int.Parse(PID);
string retMessage = string.Empty;
DATABASE db = new DATABASE();
var empQuery = from t in CAT
where (t.CAT_ID == UID)
select t;
CAT obj = empQuery.Single();
obj.CAT_NAME = CAT_NAME;
obj.DESCRIPTION = DESCRIPTION;
obj.PID = UPID;
db.SaveChanges();
return retMessage;
}
now i want call my void function in Update(Static Method) .....=
Posted
Updated 24-Nov-14 23:05pm
v3
Comments
Tomas Takac 25-Nov-14 4:33am    
You need an instance of the class to call an instance method.
Richard_Michael_RM 25-Nov-14 4:38am    
Thank you #Tomas glad to see your answer ..... Actually i have already class instance and i'm generating run time div for my menu list how is it possible by instance of class
Tomas Takac 25-Nov-14 4:41am    
It would be really helpful if you could post some relevant code. Cheers.
Tomas Takac 25-Nov-14 4:51am    
Please use "improve question" button to update your question with additional information. Then delete this comment.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900