|
Navaneeth,
I have already answered him last night about the problem. I dont know why he is putting the same question again and again in the forum rather than replying the last replies.
|
|
|
|
|
Hi Navaneeth
I want to use Enum in Web parts to show DropDown.
Web parts use only Enum to bind Dropdown.
is there ant other way to solve this problem ?
thanks
|
|
|
|
|
$unil Dhiman wrote: is there ant other way to solve this problem ?
May be. But you haven't answered to my questions which I asked on my last post.
|
|
|
|
|
Hi Navaneeth
Sorry !!!
I got busy in an urgent task at that time.
|
|
|
|
|
If this code is all you are trying to do, then you are wasting your time. Just create the Enum class for you enumerator.
On the other hand if this is a test for more complex process you should discuss this instead. For example, building enumerators from the database is a matter of Googling Emitting Enumerators using T4 . Then learn how to use T4 to dynamically build your classes inline with your code.
|
|
|
|
|
Hi Michael,
Thanks for reply.
I tried to Inherite "Enum" class. but it is giving an error message -
"cannot derive from special class 'System.Enum'"
Please help me how to create Enum Dynamically.
Regards,
Sdhimann
|
|
|
|
|
|
Hi Everyone,
I was curious if it's possible to grab the HTML that a client would receive after the server processes a bit of code. I'm building a web app that will need to send an e-mail notification to the end user. I've already created the dynamic code and display the confirmation on the screen, but what I would like to do is something like this:
MailMessage.Body = Confirmation_div.InnerHtml.ToString();
This way, I can simply email all of the items without having to rebuild the message body html. This bit of code gives me an error indicating that the server can't grab the innerHTML because the div element isn't using any literal controls. Is there a way to convert all of the dynamic controls (after the values have been designated) to literal controls, or somehow grabbing the HTML equilavent that will be sent to the client during the PAGE_PreRender or something?
Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
Every server control comes with a RenderControl() method which render the control and it's child controls to the specified TextWriter .
Trick here is to make your div run at server. Add a runat=server attribute to the Confirmation_div . Here is a generic method to get the rendered output of any control.
string GetRenderedOutput<T>(T control) where T : Control
{
StringBuilder builder = new StringBuilder();
using (StringWriter sWriter = new StringWriter(builder))
using (Html32TextWriter writer = new Html32TextWriter(sWriter))
{
control.RenderControl(writer);
}
return builder.ToString();
} Use it like
MailMessage.Body = GetRenderedOutput(Confirmation_div); OR
MailMessage.Body = GetRenderedOutput<HtmlGenericControl>(Confirmation_div);
|
|
|
|
|
Hi Navaneeth,
Thanks! I do remember seeing the RenderControl in the intellisense, but it never dawned on me to look into that method! I thought it would be "ClientOutput" or something like that.
I did have a quick question, though. Can you tell me what this line is saying?
string GetRenderedOutput<T>(T control) where T : Control
I understand Where T is inherenting from the Control class , but I've never seen <t>(T Control) before.
Thanks Again!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
modified on Monday, September 28, 2009 12:22 PM
|
|
|
|
|
T represents a Generic Type here. Means you can assign any value to T type that inherits Control.
If you write
where T : class
It would take any classes.
I suggest to read the basic books on Generics to clear it more.
|
|
|
|
|
T is a generic type and where T : Control is a constraint. It means T can be of any type that derives from Control . When you write GetRenderedOutput(yourDiv); , compiler will infer the type from the type of yourDiv . Writing GetRenderedOutput<HtmlGenericControl>(yourDiv); is more explicit and it will only take a type of HtmlGenericControl .
|
|
|
|
|
Oh, so then you could write a method to say, format or parse strings, Dictonaries<>, Lists, ect and using a generic, pass the method anything and let it figure out what it is?
bool myMethod<T>(T Object) Where T : Object {}
I'm a self-taught programmer and I've read the whole way through Head First C# (which I really enjoyed and learned a lot), but I don't recall seeing anything about generics....Or if I did, obviously it didn't sink in. I'll have to go back and review that tonight.
Thank's again for all your help!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
can any one have similar method written in asp.net please reply
Thanking you
|
|
|
|
|
What is an web user control and when shud i go for an web user control?
What is the need of an user control?
|
|
|
|
|
Web user control are those controls which we create and add to Web pages. Creating a user control for Web Application is very similar to creating a user control in Windows Application. User controls in ASP.NET are based on the System.Web.UI.UserControl.
If you need to reuse the same composite page section in a number of times, you can go to create one ASP.net web user control. After that you can just add those modules to your page (one or more times) and get their functionality.
Web user control is very easy to make. You will have both designer to create the design. This is in contrast with Custom Controls, which is just a class and needed to override the Render method.
You will be creating a Web user control just like how you create a page. So, those are just custom page reusable modules.
|
|
|
|
|
Hi,
I am developing a project in .net and vb.net, offering free web hosting with subdomain,
like Geocities and Tripod.
but i dont know that how to create subdomain programmatically by vb.net coding.
As the user will fill the member forms and will become the member , he will get a url like
http://subdomain.domain.com automatically,
i have no idea about subdomain creation dynamically , got my point
We buy from webfusion that domain name. We have user name and password from this site. But we are creating all these things previously i told that using manually in this site. But what our requirement is need to create in programmatically. we have ip address host name, username and password.
if you have any idea about subdomain creation programmatically in any language or having any general idea help me
Thanx in advance
Every Successful Person Have A Painful Story
|
|
|
|
|
download DotNetNuke ... that is a subdomained manager all in VB.net with skins.
|
|
|
|
|
Dear All,
I want to create a new ASP.Net Ajax enabled website using Visual Studio 2005, But In the dialog New Web Site this template does not exists.
Where I can download this to my Visual Studio 2005 and If I am not downloading this template, then any one can guide me how can i add ajax controls as ScriptManager,UpdatePanel, etc to my ASP.Net Page.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Try installing the ASP.NET AJAX server extensions. See here[^].
|
|
|
|
|
I have a label in my aspx page & iam changing its text via
document.getElementById("LabelID"). innerHTML = "SOmeText";
from JAVASCRIPT.
Now by default an ASP.NET label should retain its contents. But its not.
IS there any way to make it so I can change a label on the client-side and the contents persists back to the server?
If iam using a textbox it does works fine.
Proud To Be an Indian
|
|
|
|
|
I have not tried this. Just a wild guess. Try changing to innerText .
document.getElementById("LabelID").innerText = "SOmeText";
modified on Monday, September 28, 2009 10:15 AM
|
|
|
|
|
Navaneeth, I think the controls which don’t have the ‘name’ attribute wouldn’t maintain its contents on post back.
|
|
|
|
|
majee wrote: the controls which don’t have the ‘name’ attribute wouldn’t maintain its contents on post back.
For server controls, the id will be put as name. So what you are saying won't occur. The real issue here is a label render as HTML span and contents of span will not be posted to server. See my latest reply.
|
|
|
|
|
N a v a n e e t h wrote: For server controls, the id will be put as name. So what you are saying won't occur. The real issue here is a label render as HTML span and contents of span will not be posted to server. See my latest reply.
True 
|
|
|
|