|
Ahmed Galal wrote: i think i will go for the hidden fields if i failed on this.
I think this is the solution.
|
|
|
|
|
You can create your own text box control( a custom user control and can append the properties ) Is that you strictly want to write that in <asp:textbox>???
public partial class CustomTextBox : System.Web.UI.UserControl
{
String sSampleData = String.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (this.sSampleData == "")
{
Page.Response.Write("No data set");
}
else
{
Page.Response.Write(this.sSampleData);
}
}
public String MyAttribute
{
set { sSampleData = value; }
get { return sSampleData; }
}
}
<form id="form1" runat="server">
<ADT:TextBox ID="aa" MyAttribute="Its working" runat="server" />
</form>
1. The equivalent .NET class of <asp:textbox> is pre-written and you can not modify that. hence you can not add an extra "attribute" the way you have been trying to do.
2. When an attribute is added in following way
TextBox1.Attributes.Add("onclik","something");
it is added to rendered control's attribute collection.
These two attribute are different things. Thats why what you write in "design" view, after rendering you see different things.( asp:dropdownlist changes to select/option , asp:datagrid changes to <table > etc.
Thanks,
Arindam D Tewary
modified on Wednesday, April 7, 2010 9:13 AM
|
|
|
|
|
yea that would work although i was looking for a simpler method, i think hidden field is the way to go unfornatually, but thank u very much for answering.
|
|
|
|
|
Dear all,
Now i am facing with a problem relate to ASP.NET & SQL server 2008.
I have setted up my website under IIS using asp.net and connect to sql server 2008 but when i go to another page it always appear a message "Internal connection fatal error", what is wrong with it?
what is the problem?
thank you in advanced.
Note: SQL is made cluster
Best regards,
HY ChanHan
modified on Wednesday, April 7, 2010 10:03 PM
|
|
|
|
|
Have you tried exploring event viewer utility in your server so that you get to know what unexpected things are happening?
Shortcut to open event viewr is go to "run" and in text box type "eventvwr" and hit enter.
Thanks,
Arindam D Tewary
|
|
|
|
|
Hi,
I have read event viewer log already but i still did not understand and identify the problem yet.
This is error in event log
========================
Event code: 3008
Event message: A configuration error has occurred.
Event time: 4/7/2010 3:49:19 PM
Event time (UTC): 4/7/2010 8:49:19 AM
Event ID: 52e8d5c88a1b44b6b7c65c488194428e
Event sequence: 4
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT/web-5-129151037592720313
Trust level: Full
Application Virtual Path: /web
Application Path: C:\inetpub\wwwroot\web\
Machine name: WEBSRV02
Process information:
Process ID: 4952
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 13
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.HttpContext.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_ConnectionStrings()
at Modules_ContactInformation.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\web\Modules\ContactInformation.ascx.cs:line 19
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.contactinformation_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\web\e89da7a8\a3638734\App_Web_1_ijqsns.14.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
==========================================
Thanks,
|
|
|
|
|
Hi
You log information shows that code written at line 19 is creatig the error.
Hy Chanhan wrote: at Modules_ContactInformation.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\web\Modules\ContactInformation.ascx.cs:line 19
Please check whats happening there. Or post some code block related to that line.
Thanks,
Arindam D Tewary
|
|
|
|
|
My client uses the Dynamic Web Service to get data.
There is Class ClassA in Web Service. When get the one object of the ClassA from the Web Service, I can not change this object from type object to ClassA event I define the same class, ClassA in my client.
Is there any way to use the ClassA object data?
|
|
|
|
|
You can send or recieve objects from webservice.It has to be in XML form.One thing you can do ,convert your object in byte array and at recieving end, you can again cast it in your class type.
Have a look
|
|
|
|
|
Brij,
Thanks for your reply.
When the object is the type of String or other system type, there is no problem.
But it has problem when use the customer define class.
I want to know why data cannot be converted between these two class with the same define but in different place.
|
|
|
|
|
Hello, I have found in JAVA, that, every class no matter how small it is, must be placed in a different file with the class name. But in C#, I found that it is not necessary, I can put many classes in the same file. I thought it is a flexibility in C#. But, my ReSharper and CodeRush refactoring tool suggesting me to place my classes into different files. From that point of view, I am thinking, IS IT just a best practice to place all tiny classes into different files with the class names which is enforced in JAVA ?
modified on Wednesday, April 7, 2010 4:27 AM
|
|
|
|
|
I always have simply because I'm not always working solo and when I go, there could be a team who comes in later to add enhancements. That being the case, having multiple classes in one file runs the risk of unnecessary file locking because someone wants to work on class A but it's in the same file as class B which is being worked on by someone else at the time.
|
|
|
|
|
Thanks, so, I got one good reason to use different files for classes.
|
|
|
|
|
I believe it is as 'your choice'. The reason being
1. in C# microsoft introduced the concept of partial class which allows you to span your class across multiple files.
2. in C# any class finally yeild a 'dll' which does not bother about how physically the class was written
3. There are multiple source control software available which allows multiple person to work paralelly. Lock and conflict is is at all discouraged and these are taken as normal mode of working and let the tool work to get the maximum benifit out of it. ( MS TFS allows to work multiple person simultanously ).
And from my experience I didn't see anyone at least in C# that it is a best practice to have classes in separate file. It could be project specific ( may be where you might be working they want for some reason or so) best practices, but not a general best practice.
Thanks,
Arindam D Tewary
|
|
|
|
|
Hi all,
I am working on a windows application in which I am using a NotifyIcon. When I try to trigger its click or ballontipclick event, it do not responds.
But in windows application it works fine.
any idea....
Regards....
|
|
|
|
|
You are not at right place.This is ASP.NET forum.Post your problem in C# section.
|
|
|
|
|
Friends,
have any problem with Ajax Tab Container and IE 8 latest version. because tabcaontainer wrking(visible) in all other browser's except this.
Thank you.
|
|
|
|
|
I used MS Chart in my aspx, but now i want to print MS Chart only but How can i print MS Chart using asp.net
|
|
|
|
|
|
Hello Friends,
I want to print in Landscape format. And here is my code below
.landScape
{
width: 100%;
height: 100%;
margin: 0% 0% 0% 0%;
filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);
}
........
but this code is not working
|
|
|
|
|
|
i've stored an image in binary format in database using ADO.net and i want to display the image in adrotator or into an image type control..but i don't know which function to use;
i connected the adrotator to sqldatasource through a configure datasource wizard and when i tested the query there in wizard it worked f9...but on running the application no image is displayed in adrotator.....CAN ANYONE HELP ME...??
|
|
|
|
|
Here is the sample code to show in page from database which i used earlier..!
byte[] arrContent = null;
DataTable dt = new DataTable();
DataRow dr = default(DataRow);
int id = Convert.ToInt32(Request.QueryString["id"]);
dt = PlayerInfo.ImagSelect(username);
dr = dt.Rows[0];
arrContent = (byte[])dr["photo"];
int length = arrContent.Length;
Response.ContentType = "image/JPEG";
if (length!=0)
Response.OutputStream.Write(arrContent, 0,length);
Response.End();
You can check this link to sample Image Control..!
ships_agr wrote: i connected the adrotator to sqldatasource through a configure datasource wizard and when i tested the query there in wizard it worked f9...but on running the application no image is displayed in adrotator
It Should be converted to binary format .You can visible the image thr wizard but not in page..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi All,
I want to store viewstate of entire page. Then on next visit to a page I want it to restore it's state by applying the viewstate I had stored. I found this article very helpful for this Persisting the state of a web page[^]
However it did not solve my problem completely. This article shows how to store viewstate an POST data of a page and then restore it back using stored data. To restore data from POST you need to turn off some security feature. I can't do that so I removed the code which was responsible to store and restore POST data. So now I have a code which just stores viewstate and restores it back.
With this change most of the things started working for me but RadioButtonList is not able to maintain the selected item. With some more experimentation I found out that selected item of RadioButtonList is not stored in viewstate, it is stored in POST data. Is this a correct conclusion?
If it is correct then does that mean I will not be able to restore page completely by storing only viewstate?
Regards
Shrikant
|
|
|
|
|
I don't see the point in this. If you want to restore the page then persist the values and set the controls appropriately when restoring.
I know the language. I've read a book. - _Madmatt
|
|
|
|