|
Hi everyone,
I have some usercontrols which implements my custom interface IMyControl.
I want to know if there is a EASY and EFFICIENT way to retreive all my custom controls with type = IMyControl from either ASP.net page or winforms.
I know I can recursively loop through each control.controls and compare the typeof ctrl is IMyControl but I think this is not efficients if I have nested level of controls?
thanks in advance..
cheers.
Wilson
Still a newbie.. learning
|
|
|
|
|
Y can't you use 'findcontrol()' method. Will it solve your problem ?
Thanks & Regards,
Jeneesh k. v.
|
|
|
|
|
thanks.. but don't think that is what I want to achieve..
what I want to do is retreive all those controls with specify type e.g. IMyControls. then I can call a function declared within that interface for all those controls. . I don't think I can just the FindControl to get certain TYPE of control?
Cheers,
Wilson
Still a newbie.. learning
|
|
|
|
|
Hi to all,
I am using formview control to generate invoice. Instead of printing html view , it is printing html code in PDF. I am doing like this:
public void generate()
{
MemoryStream m = new MemoryStream();
Document document = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
try
{
Response.ContentType = "application/pdf";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
FormView1.RenderControl(htw);
string html = sw.ToString() ;
StringBuilder str = new StringBuilder();
str.Append("<h3><b>Online Application Form Details </b></h3>");
str.Append(html);
PdfWriter writer = PdfWriter.GetInstance(document, m);
writer.CloseStream = false;
document.Open();
document.Add(new Paragraph(str.ToString()));
}
catch (DocumentException ex)
{
Console.Error.WriteLine(ex.StackTrace);
Console.Error.WriteLine(ex.Message);
}
document.Close();
Response.OutputStream.Write(m.GetBuffer(), 0, m.GetBuffer().Length);
Response.OutputStream.Flush();
Response.OutputStream.Close();
string filename = "~/Invoices/sample.pdf";
string path = Server.MapPath(filename);
m.WriteTo(new FileStream(@path, FileMode.Create));
m.Close();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
please assist me.....
cheers,
sneha
|
|
|
|
|
hi friends..
iam working with remote ssrs in sql2005.i deployed reports to my remote server sucessfully...but when am conneting to reportviewr am getting
"One or more data sources is missing credentials"
this error...
ReportViewer1.ShowCredentialPrompts = false;
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerNetworkCredentials();
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://SAI/ReportServer");
ReportViewer1.ServerReport.ReportPath = "/TotalStudentsReport/TotalStudentInfo";
ReportViewer1.ServerReport.Refresh();
this is the my code..and also mentioned credentials ..
please help me..
txs in advance...
|
|
|
|
|
Hello -
I need a help with this issue and I hope someone can help me. I want to have a page which will perform a delayed action, lets say, after 10 minutes execute some method, but I want the user to be redirected in the same moment when the button will be clicked, not to wait 10 minutes for the next page.
Like even if the page is closed, the code to be executed after the amount of time I will declare.
Is that possible?
Thanks a lot for every help, Laziale
|
|
|
|
|
Hi
You can use multithread programming and Ajax(to inform work complete)
Multithreading:
when the server recieves the client's request , the web application
delegates a secondary thread to do time consuming task and responses the
client to be waiting.
Ajax:
the client callbacks every 10 minutes(for example) to the server to inform
whether the task is completed or not
Hope to be useful
Mohammad Khansari
|
|
|
|
|
that will work even if a user close the page?
|
|
|
|
|
hi
yes
Mohammad Khansari
|
|
|
|
|
for some reason, once the user(in this case, me) close the page, every process stops.
Can you please give me some example, chunk of code to see your idea, please.
Thx in advance, Laziale
|
|
|
|
|
hi
the application pool is always run.
when the process is stopped the secondary thread is working to finish
it's task. when it finish it's task the result must be saved on
application state or database or hard disk
It is only an idea and I have not implement it yet.
hope to help you
another solution:
you can use Ajax and a httphandler(it can be your page) without any
submit and any multithreading.
(I think it is better than previous approach)
Mohammad Khansari
|
|
|
|
|
Hi,
I wish to implement the following behaviour:
Once logged in to my webapplication if the user hits back button on the browser .... log them out.
I am researching a possible solution for this using the "onbeforeunload" Javascript event.
However how does do you request a logout initiated from the client side ?
Any help would be appreciated
|
|
|
|
|
Well, But there are few browsers which doesnt places a server call when back button is hit. Even your ajax request in the page will be invoked but with same parameter.
I am unsure if it actually can be done. onbeforeunload event is generated when you navigate away from the page, like you close the window, you click on any link etc. By this, you cant trap if back is hit or not...
gerrybrennan wrote:
However how does do you request a logout initiated from the client side ?
Just invoke an AJAX request to the server which will remove the authentication variable in the server.(might be in session)
|
|
|
|
|
... or in load event of login.aspx page, just clear the authentication variables! (Session.Remove("Credentials") ? or something like that) ...
And if you want, you can add
Response.AddHeader("pragma", "no-cache");
Response.AddHeader("cache-control", "private");
Response.CacheControl = "no-cache";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore(); on load event to prevent the Back button of browser and let the user see the last page before the log out... good luck!
|
|
|
|
|
Hi I have a webapplication with many pages.
I wish to put a check in the page_load of the masterloggedinpage to check if Javascript is enabled & cookies are enabled.
Reason being i do not want to place a check on every page.
If they are not enabled I will force a FormsAuthentication.SignOut()
Can anyone help with some suggestions on how to perform this operation ?
Thank you in advance.
|
|
|
|
|
|
Hi !
I need to create the HttpModule that will work not for specific application, but rather for the whole site, like ISAPI filter defined on the Web Site level.
How I can register it without application, and hence without web.config?
Seems to be simple question, but I burned away enough time looking for the answer in the internet (including CP site) with no luck. All examples end up in application and it's web.config.
May be it is evident, and I simply too dumb to see it?
Thanks in advance.
Regards,
Gennady
My English is permanently under construction. Be patient !!
|
|
|
|
|
hi
You should know how the native asp.net httpmodules were registered to
the websites and register your own like them
I think that they were registered in Machine.config file
Hope to be useful
Mohammad Khansari
modified on Thursday, January 7, 2010 3:11 AM
|
|
|
|
|
Hi !
Thanks for your response and sorry for delay - I had no access to the internet.
Yes, this is one of methodes that I thought about. Another is - place the short web.config
to the root of web site. I'm not sure that any one of these methodes is right, so I wanted to
get the "authoritive" answer. I'm new in this field, so when my first HttpModule will fail to
work, I'd like to exclude the registration mistakes. At least.
Regards,
Gennady
My English is permanently under construction. Be patient !!
|
|
|
|
|
My page uses an asp .net menu that is not enabled like this:
|
|
|
|
|
Hi,
You are using it correctly but just one mistake you have made is making the Menu disabled in server side.
Use
<asp:Menu disabled="true"
Rather than
<asp:Menu Enabled="False"
Because when you make a control disable from server side you will not be able to get it from client side.
Also try using getElementById only in place of getElementByIdWithReplaceCheck if it does not work out.
Hope it Helps.
Regards,
Kaushal Arora
|
|
|
|
|
|
<p>Hi,</p><p>Try this: <font face="Verdana">getElementByIdWithReplaceCheck("ctl00_Menu1").visibility= false;<br /></font></p><p><font face="Verdana">hope this helps.</font></p>
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 9:00am.
|
|
|
|
|
|
Do the following thing :
step 1 :load file
FileInfo fileinfo = new FileInfo(yourfilePath);
step 2 : open file using jet provider
string strSql = "SELECT * FROM [" + fileinfo.Name + "]";
string strCSVConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileinfo.Directory.FullName + ";" + "Extended Properties='text;HDR=No;'";
step 3 : load data set
OleDbDataAdapter oleda = new OleDbDataAdapter(strSql, strCSVConnString);
DataTable dtbCSV = new DataTable();
oleda.Fill(dtbCSV);
step 4 : wite to xml
dtbCSV.WriteXml()
|
|
|
|