|
The obvious question is why not add the runat attribute?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
if i did add runat="server" i can access mydiv.innerText from .cs page.
please let me know if any way to access that.
|
|
|
|
|
When you add a runat=server attribute to an html element it is automatically wrapped as a HtmlGenericControl. Your first attempt gained you nothing.
So rather than this
HtmlGenericControl div = (HtmlGenericControl)Page.FindControl("mydiv");
if (div != null)
{
div.InnerHtml = "test message";
}
You could have this
div.InnerText = "test message";
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
when i add runat="server" no need to access via
HtmlGenericControl div = (HtmlGenericControl)this.FindControl("mydiv");
please check this image[^]
thank you for your time.
|
|
|
|
|
You can not access a Div without add runar="server" in code behind.
But you can get input element without add runar="server" like this:
in code behind
string pName = Request.Form['pName'];
|
|
|
|
|
Hello!
Is there an example project for ASP.NET www.codeproject.som. In which would be implemented to work with the database, loginizatsiya user, and work with the sessions. It is possible, and other functions, but the main three.
|
|
|
|
|
Hello,
I have created many user controls with custom properties, methods, etc. to help interact between my business layer and presentation layer. I have also developed a custom page class that is derived from the base Page class. Everything works well if I create my aspx pages statically and by this I mean insert the markup directly into the aspx pages source.
I had an idea to try and make my application more user friendly and have my pages source come from xml files defined by the end user. Since all of my custom server controls are in a single assembly, I figured I could use reflection to create the controls and insert them into the page. I have the code for this written, however, when I add the controls to the page (using reflection), I cannot access the base page class from within my custom controls.
Example.
I have a base page called UIBase dereived from System.Web.UI.Page.
I have a server control that is derived from System.Web.UI.Control. Within my custom control, I have a property that returns the controls page cast as the UIBase (which ALL of my pages within the site are set as via web.config)
public readonly property CtlPage() as UIBase
Get
Return ctype(me.page,UIBase)
End Get
end property
When I use reflection, I get an error within the return statement above. Unable to cast webform3_aspx as UIBase. I can dynamically add the controls via the page_init and add them to the page with no problem. This error only happens when reflection is used....
Also note that the UIBase class is in the same assembly as all other controls. Could this be the problem?
Here is my code that uses reflection to add the controls to the page.
Dim ctlAssem As System.Reflection.Assembly
Dim an As System.Reflection.AssemblyName = New System.Reflection.AssemblyName("MyWeb.Web.UI.Controlls")
an.CodeBase = "MyWeb.Web.UI.Controlls.dll"
ctlAssem = System.Reflection.Assembly.LoadFile("../../MyWeb.Web.UI.Controls.dll") 'shortened for readability
Private Sub initControls()
Dim mst As uibasepage_master = Page.Master
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(Server.MapPath("~/page_source/Employee.xml"))
Dim root As XmlNode = xmlDoc.DocumentElement
createControls(root, mst.BodyContent)
End Sub
Private Sub createControls(ByRef parentNode As XmlNode, ByRef parentCtl As Control)
If parentNode.ChildNodes.Count > 0 Then
For Each childNode As XmlNode In parentNode.ChildNodes
Dim ctlType As Type = ctlAssem.GetType("MyWeb.Web.UI.Controls." & childNode.Name)
Dim ctl As Control = Activator.CreateInstance(ctlType)
For Each ctlAttr As XmlAttribute In childNode.Attributes
Dim pi As System.Reflection.PropertyInfo = ctlType.GetProperty(ctlAttr.Name)
If pi.PropertyType Is GetType(String) Then
pi.SetValue(ctl, ctlAttr.Value, Nothing)
ElseIf pi.PropertyType Is GetType(Boolean) Then
If ctlAttr.Value.ToString.ToLower = "true" Then
pi.SetValue(ctl, True, Nothing)
Else
pi.SetValue(ctl, False, Nothing)
End If
End If
Next
parentCtl.Controls.Add(ctl)
If childNode.HasChildNodes Then
createControls(childNode, ctl)
End If
Next
End If
End Sub
Thanks to anyone that can help. This has drove me nuts for a few days now.
|
|
|
|
|
What are you using the UIBase for? Sounds to me like you should be using a Master page instead. Then you can get to the master using this.Page.Master.
|
|
|
|
|
Thanks for the reply. I am using the UIBase page as I have a few different master pages included within the project. I use the UIBase page to dynamically register client scripts depending on which controls or current page. Also, I use the UIBase page to capture errors from the content pages and controls.
|
|
|
|
|
I have a problem that I'm not sure what to do about.
I have a asmx web service (as opposed to WCF) that I deployed to an existing website which resideson a secure server (https).
I have a silverlight 3 app on the same site that is supposed to use this service, but when it tries to call one of the methods, I get this exception:
The provided URI scheme 'https' is invalid; expected 'http'.<br />
Parameter name: via<br />
at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)<br />
at System.ServiceModel.Channels.HttpChannelFactory.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)<br />
at System.ServiceModel.Channels.HttpChannelFactory.OnCreateChannel(EndpointAddress remoteAddress, Uri via)<br />
at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)<br />
at System.ServiceModel.Channels.ChannelFactoryBase`1.CreateChannel(EndpointAddress address, Uri via)<br />
at System.ServiceModel.Channels.ServiceChannelFactory.ServiceChannelFactoryOverRequest.CreateInnerChannelBinder(EndpointAddress to, Uri via)<br />
at System.ServiceModel.Channels.ServiceChannelFactory.CreateServiceChannel(EndpointAddress address, Uri via)<br />
at System.ServiceModel.ClientBase`1.ChannelBase`1..ctor(ClientBase`1 client)<br />
at FMDashboard2.FMDashboardReference.FMDashServiceSoapClient.FMDashServiceSoapClientChannel..ctor(ClientBase`1 client)<br />
at FMDashboard2.FMDashboardReference.FMDashServiceSoapClient.CreateChannel()<br />
at System.ServiceModel.ClientBase`1.CreateChannelInternal()<br />
at System.ServiceModel.ClientBase`1.get_Channel()<br />
at FMDashboard2.FMDashboardReference.FMDashServiceSoapClient.FMDashboard2.FMDashboardReference.FMDashServiceSoap.BeginGetListOfOrganizations(GetListOfOrganizationsRequest request, AsyncCallback callback, Object asyncState)<br />
at FMDashboard2.FMDashboardReference.FMDashServiceSoapClient.BeginGetListOfOrganizations(AsyncCallback callback, Object asyncState)<br />
at FMDashboard2.FMDashboardReference.FMDashServiceSoapClient.OnBeginGetListOfOrganizations(Object[] inValues, AsyncCallback callback, Object asyncState)<br />
at System.ServiceModel.ClientBase`1.InvokeAsync(BeginOperationDelegate beginOperationDelegate, Object[] inValues, EndOperationDelegate endOperationDelegate, SendOrPostCallback operationCompletedCallback, Object userState)
When I try to browse directly to the web service, I get this asp.net exception:
Server Error in '/fm/tools/batsnet/FMDashboardService' Application.<br />
--------------------------------------------------------------------------------<br />
<br />
Configuration Error <br />
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. <br />
<br />
Parser Error Message: Could not load type 'BATS.NET.Auditing.WebAuthenticationFailureAuditEvent'.<br />
<br />
Source Error: <br />
<br />
<br />
Line 185: <add name="Audit Events" type="System.Web.Management.WebFailureAuditEvent" startEventCode="0" endEventCode="2147483647"/><br />
Line 186: <!-- Log authentication failure events --><br />
Line 187: <add name="Auth Failure Audits" type="BATS.NET.Auditing.WebAuthenticationFailureAuditEvent" startEventCode="0" endEventCode="2147483647"/><br />
Line 188: <!-- Log membership audit events --><br />
Line 189: <add name="Membership Audit Events" type="BATS.NET.Auditing.WebMembershipAuditEvent" startEventCode="0" endEventCode="2147483647"/><br />
<br />
<br />
Source File: D:\Web\aetc\fm\tools\batsnet\web.config Line: 187 <br />
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I have a dropdownlist2 in a gridview whose datasource and select control parameter is based on the selected value of dropdownlist1 in the same gridview. Everything works great for insert, but when I edit the row in the gridview and change the selected value in dropdownlist1, I get an error of "'dropdownlist2' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value" This kinda makes sense to me. At what stage (maybe drowdownlist1 selectedindexchanged?) do I tell dropdownlist2 that it needs to requery so I don't get the error. I can just tell it to select the 0 index by default here for dropdownlist2. An example would be lovely.
|
|
|
|
|
HI all,
I have value stored in DATETIME variable in "2010-03-15 08:00:55" this format
but i want to know to 15 march 2010 is a sunday or monday .......how to do this
Thanks and regards,
Amit Patel
|
|
|
|
|
Hiding in plain sight in the documentation
DateTime dt = DateTime.Parse("2010-03-15 08:00:55");
if(dt.DayOfWeek == DayOfWeek.Sunday || dt.DayOfWeeek == DayOfWeek.Monday)
{
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I've added the AutoCompletExtender using a webservice to a textbox and all is well, except, the list is long (maybe 20,000 records from a dataset). How can I add a scroll bar and limit the number of suggestions? I tried adding the following except when I tried to drag the scroll bar, it triggered the onlick event. Any help would be greatly appreciated.
#AutoComplete
{
width: inherit;
overflow: scroll;
height: 200px;
}
Visual studio 2008
AjaxControlToolKit 3.5
C#
Web Page
Sql Dataset
|
|
|
|
|
Increase your MinimumPrefixLength. A dropdown with 20000 items isn't useful to anyone.
|
|
|
|
|
This is certainly a good suggestion; however, I would still be inerested in a scroll bar.
|
|
|
|
|
The one that comes in the AjaxControlToolkit has a scrollbar already. AutoComplete[^]
If you can't use that one, get the source for the toolkit and see how they implement it to provide taht scrollbar.
|
|
|
|
|
I've got the scroll bar working through thr CSS. Thanks for all your help.
|
|
|
|
|
In .NET 1.1, the machine.config file has an element processModel with the following two attributes:
1. maxWorkerThreads
2. maxIoThreads
Where can I set the same in .NET 2.0?
Thanks.
|
|
|
|
|
hi to all....
i have no so much experience in sql.
one query i want may be its simple but still i want it.
if there is table "EmpTbl" with fields
empid,empname and salary.
Then how i find the second max salary and second last salary of the Employee???
plz help me out ...
thanks
|
|
|
|
|
You'll get a lot of results if you search on google anyways..
Here the queries..
For second max.
select MAX(salary) from EmpTbl where salary < (select MAX(salary) from EmpTbl)
and For second min
select Min(salary) from EmpTbl where salary > (select MIN(salary) from EmpTbl)
|
|
|
|
|
thanks a lot ok from this i will search on google instead of asking in forum..
but thanks a lot .....
|
|
|
|
|
Here is one I did for freight_cost: You will need the second example.
-- max cost
SELECT MAX(Freight_Cost)
FROM Product_Freight_Cost
-- 2nd max cost
SELECT MAX(Freight_Cost)
FROM Product_Freight_Cost
WHERE Freight_Cost NOT IN (SELECT MAX(Freight_Cost) FROM Product_Freight_Cost)
|
|
|
|
|
|
I created div like this:
<br />
System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");<br />
And hyperlink like this:
<br />
System.Web.UI.WebControls.HyperLink link = new System.Web.UI.WebControls.HyperLink();<br />
link.NavigateUrl = "http://blabla.com";<br />
link.Text = "Click here";<br />
link.Target = "_blank";<br />
Now I am trying to display this link in div that i could click on it. When I add link to div like this:
<br />
dynDiv.InnerHtml= link;<br />
It doesn't work.
Help plz.
|
|
|
|