|
i have a class called common,which holds the reference to a web service,every time when i want to use the web service i called a method connect() which returns webservice.service and through that i call the relevant method in the web service.
what i want to know is whether this way, means creating a new instance for the web service every time is effective,
because as we work with db after finishing the work we disconnect the connection to db.
here we don't do it.if this way is not effecient what would be the most effective way?
|
|
|
|
|
Are you creating instance at the click of calling web-methods or its on class initialization?
1) If you are using it on click of button then you should kept it under the class constructor. This will reduce the no. of request to get the web-service methods at every click.
2) Other way is: if your web method is not parameterized and you require each time the same output then you can go for the shared variable, just store the output in your shared variable and use it instead of calling web-service again and again.
~Sanjeev
|
|
|
|
|
the situation is that i call different web methods on different button clicks, with passing parameters.
public static rservice.Service connect_webserver()
{
rservice.Service srv = new rservice.Service();
srv.CookieContainer = new CookieContainer();
return srv;
}
this is the code that i use to create a new instance of the web reference.
for each button click i call this method to refer the web service.
i think this is like creating connections to db for each db call.if i'm correct
then i think this is not good, if so using a shared connection might be efficient.
then can you tell me how to find some articles about this.
|
|
|
|
|
|
i am having trouble changing some data fields within this form, and am wondering if anyone can help me.
this is the coding.
the last paragraph (child care type onwards) needs to be set to have a dropdown list containg the following information
crèches
toddler groups
pre-schools and playgroups
day nurseries
out-of-school or 'kids' clubs
childminders
nannies
if anyone can help contact me asap thanks
<tr>
<td>Child Care Type</td>
<td><asp:textbox id="txtChildCareType" runat="server" xmlns:asp="#unknown"></asp:textbox></td>
</tr>
|
|
|
|
|
What is your question ? I *think* it's 'I took a paid job and have no idea how to do it', but the specifics are lost on me. You have a list of strings, and you have a textbox. Why don't you have a drop down list ? What data field are you changing ? What are you changing it to ? You can't seriously be asking us how to create a drop down list ? Buy an ASP.NET book, and read it. In the meantime, tell your client you lied to them.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
touchy touchy. someone thinks they are the master at asp.net coding. i was only asking a general question thought forums were provided to help, and i guess someone has too much time on their hands, coming up with sarky comments to put people down. im actually creating a university project using asp.net coding, i am not getting paid and i have no client to tell them i lied to them. but hey you cant be right all the time better luck next time chum(p)
|
|
|
|
|
When i am calling Excel() it is showing the error cs1503,it is saying that Excel is not taking the arguments,which argument i have to give in this code
private void lnkExport_Click(object sender, System.EventArgs e)
{
Excel();
}
private void Excel(DataGrid DGInbox,HttpResponse response)
{
response.Clear();
response.Charset = "";
response.ContentType = "application/vnd.ms-excel";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DGInbox.GridLines = GridLines.None;
DGInbox.RenderControl(htmlWrite);
for(int i=0;i<DGInbox.Items.Count;i++)
{
response.Write(DGInbox.Items[i].Cells[0].Text+"\n"+DGInbox.Items[i].Cells[1].Text);
}
response.End();
}
|
|
|
|
|
you should post the actual errror message. However, in this case, it's not hard to see the issue. Buy a basic C# book, and read it. Don't play with things like excel when you have no idea of the basics of C#, it won't help you.
rakeshs312 wrote: Excel();
rakeshs312 wrote: private void Excel(DataGrid DGInbox,HttpResponse response)
Your error is correct. There is no overload of the Excel method that takes no parameters.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
the function written by by needs two parameter, you must pass it in your function call like
Excel(datagrid object,response object)
The miracle is this--the more we share, the more we have.
|
|
|
|
|
Which edition is there for silverlight control...?
How to get the control?
what does it supporting file?
Ch.Gayatri Subudhi
|
|
|
|
|
Is google broken where you live ? Is this question in English ? What are you asking ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Lol Driven to the arms of CG
|
|
|
|
|
|
He means that he found my response both amusing, and inevitable.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i am trying to work on Ajax Tab Container in which i have placed Regular Expression to validate the password,but unfortunately i could not get the proper result
means the validation is not happening at client side.
Any Suggestion please
With Best Regards
|
|
|
|
|
Hi
I am developing an windows application that tries access our handler which calls a provider for the configuration settings. Our Provider cs file contains constructors that access the current httpcontext which is null always, if i access it from my application. My colleague suggested to find a way to instantiate that HttpContext. I googles it but could find any thing. Does anyone here have any idea please!!
Any Ideas would be great!
Thanks in advancs,
|
|
|
|
|
Hi,
i'm just guessing but I don't think it is possible to have an HTTP context within an windows application. How do you use the HttpContext? Maybe it is easy to replace this one against sth that is useful within windows apps and web apps.
Regards
Sebastian
|
|
|
|
|
Hi Sebastian,
Thank you for your reply. I didn't get exactly. The followign code explains clearly how I want to have it in windows applciation.
My dll which access my handler.
private void button1_Click(object sender, EventArgs e)
{
LoadConfigFile(System.Threading.Thread.GetDomain().BaseDirectory);
HttpContext context;
try
{
context = (HttpContext)HttpContext.Current;
}
catch { }
doXtopNotifications.EmailNotifications emailNotifications = new doXtopNotifications.EmailNotifications(this.lastExecutionTime, this.actions, context);
}
EmailNotifications.cs
public GlobalSettings gs;
public void Init(HttpContext ctx)
{
ConfigurationProvider configProvider = new ConfigurationProvider(ctx);
this.gs = configProvider.GlobalSettings;
}
public EmailNotifications(DateTime lastExecTime, XmlNodeList actions, HttpContext ctx)
{
Init(ctx);
}
My Handler class:
public class ConfigurationProvider
{
GlobalSettings _globalSettings = null;
HttpContext context = null;
public ConfigurationProvider()
{
context = HttpContext.Current;
}
public ConfigurationProvider(HttpContext ctx)
{
context = ctx;
}
public GlobalSettings GlobalSettings
{
get
{
//My Code fails in this block of code. I need to get GlobalSettings to access.
if (this.context != null)
{
if (this.context.Application["GlobalSettings"] == null)
loadSettings();
else
_globalSettings = (GlobalSettings)this.context.Application["GlobalSettings"];
}
return _globalSettings;
}
}
}
|
|
|
|
|
Well, as I can see it you are using the context to get the "GlobalSettings" from the Application-wide cache (ApplicationState). As a windows app itself does not use the same "session-model" like webapps, you have to load the settings when you want them to access.
I propose a little refactoring of your code. Maybe the "loadSettings"-method should return an instance of "GlobalSettings". If you have an instance of HttpContext, store the settings within the context. This will work for your webapps. If there is no HttpContext you are propably within a windows app, so you don't store them within a context, just return them. (If you like to cache them, just use the singleton-pattern).
Hope this helps you a bit.
Regards
Sebastian
|
|
|
|
|
Thanks again for the reply. Can you post sample code how it be done for the windows application.
|
|
|
|
|
1. Change the signature of your loadSettings-method
public GlobalSettings LoadSettings() {
}
2. Then change your GlobalSettings-property in ConfigurationProvider
public GlobalSettings GlobalSettings {
get {
GlobalSettings oSettings = null;
if(this.context != null) {
}
if(oSettings == null) {
oSettings = this.LoadSettings();
if(this.context != null) {
}
}
return oSettings;
}
}
This should work.
|
|
|
|
|
How to pass value through java script in asp.net from one textboxt's value to label in same webpage.
Ch.Gayatri Subudhi
modified on Monday, March 16, 2009 5:16 AM
|
|
|
|
|
There's been some examples posted, even tonight.
You need the client side ids of both controls ( which you get on the server with the ClientID property ). The you use document.getElementById to find both controls. Then you copy the value across.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
is it like this way...
function f1()
{
document.getElementById("t1").value=document.getElementById("lb1").value;
Ch.Gayatri Subudhi
|
|
|
|