Some of my servercontrols dont need ID's (i never need to access them from codebehind), removing them is rendering fine without comlaints. Is this ok?
why im dont want IDs? im using a .resx for different languages and from what I understand these must tied to a server control. And im tired of comming up with new pointless unique names. Also the these ID's gets insanly long as clientID.
I'm trying to develope a collapsible panel control with designer.
I have the following two classes:
[Code]....
and this one:
[Code]....
In fact, the designer class is a copy of a sample class in MSDN and I only tried to customize it to work for me. I'm not sure if all methods are necessary or not.
I have the following two questions:
1- When I use this contrl in design mode, I can add or delete controls to it, in the html view, tags are not updated. so when I close the page and open it again, all changes are lost.
2- I have added this control to the same asp.net project that is using this control. Isn't there any way to have this controil in tool box?
I'm new to writing custom ASP.NET server controls, and I'm encountering the following issue:
I have a control that inherits from System.Web.UI.HtmlControls.HtmlGenericControl. I override the control's Render method, use the HtmlTextWriter to emit some custom HTML (basically a TD tag with some custom attributes), and then call the case class' Render method.
i have created a aspx page with the script manager, update panels and so on. Now, when i use some jquery functions which are included inside the head tags, when the page is run, i find the script tags generated inside the body instead of the head tag. i'm using visual studio 2005 only.
I am building a forum and I want to use forum-style tags to let the users format their posts in a limited fashion.Currently I am using Regex to do this.As per this question:How to use C# regular expressions to emulate forum tags. The problem with this,is that the regex does not distinguish between nested tags.Here is a sample of how I implemented this method:
public static string MyExtensionMethod(this string text){return TransformTags(text);} private static string TransformTags(string input) {string regex = @"[([^=]+)[=x22']*(S*?)['x22]*](.+?)[/(1)]"; MatchCollection matches = new Regex(regex).Matches(input); for (int i = 0; i < matches.Count; i++) var tag = matches[i].Groups[1].Value; var optionalValue = matches[i].Groups[2].Value; var content = matches[i].Groups[3].Value; Now,if I submit something like [quote] This user posted [quote] blah [/quote] [/quote] it does not properly detect the nested quote.Instead it takes the first opening quote tag and puts it with the first closing quote tag.Do you guys recommend any solutions?Can the regex be modified to grab nested tags?Maybe I shouldn't use regex for this?
CREATE TABLE [dbo].[tbl_Module_Tag]( [AutoId] [int] IDENTITY(1,1) NOT NULL, [ModuleId] [int] NOT NULL, [ItemId] [int] NOT NULL, [TagId] [int] NOT NULL ) ON [PRIMARY]
I want get the last 3 items in the tbl_Module_Tag but with no duplicate value, get uniq tags For exemple If the data the query "select tagid from tbl_Module_Tag order by autoid desc" return this values..........
This type of thing. when I first came across it I loved it, i'm using it again today but not quite so simply. I have a number of extra things I would like to achieve.
Apply formatting to the value. Like Text='<%# string.Format(XPath("FACEVALUE"), "{0:c}") %>'> <asp:LinkButton ID="lnkBook" runat="server" PostBackUrl='/THEATRE/' + XPath("FACEVALUE")>Book</asp:LinkButton>
For option number 2 the URL is not as I would expect, and for number 1 I cannot get the syntax correct if it's even possible.
I have not been able to find something suitable in google. Hopefully what I am trying to achieve is obvious from the example :)
Is there a way to apply your own CSS tags to <li> tags when using ASP .NET 4.0 menu control? For example, say I have an external style sheet that has tags "class1", "class2", "class3", and etc. I want to apply "class1" to the first menu item. Then if menu item is selected, I want to apply "class2" and if it's not selected, "class3". I played with various 'Static' styles, but just can't get it work. I finally gave up and created my own menu control that extends ASP .NET menu control and provides my own custom rendering. This works, but I'm wondering if there is a way to get it work with built-in menu control.
Is it possible that I reserve a asp.net code in db and load it at runtime. the asp.net code contains server side tags like Text='<%# Eval("Description") %>'
I haven't been able to find relevant information through searches. I'm very green when it comes to sever side scripting. I have an ASPX page with a standard form. In the head I have meta tags, the title tag, and a link tag neatly ordered on their own lines. However, when viewing the source code after publishing to the server, the spacing between the tags is removed and it looks quite messy. (There are also <style> and <script> tags that follow, but they remain unaffected.)
I realize this has no practical effect on the site itself (in an SEO sense or otherwise). My project manager shows the source code to our clients to educate them on meta tags and page titles. It would help if it wouldn't become jumbled like this. I wonder if this is a common issue and if it's possible to prevent through better coding practices. HTML as authored, with tags separated on their own lines:
HTML Code:
<head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Welcome to Lawn Care Waukesha - Cut My Lawn. Cut My Lawn - Lawn Care Services has offered quality lawn cutting, fertilizing, aerating, and much more at affordable pricing since 2002! We currently offer lawn care service to Waukesha, Brookfield, Pewaukee, Menomonee Falls, and surrounding communities." /> <meta name="keywords" content="lawn cutting, lawn mowing, lawn care, fertilizing, aeration, mulching, shrub trimming, lawn mowing, edging, pruning, mulching, weed control, waukesha, Brookfield, Pewaukee, menomonee falls" /> <title>Lawn Care Waukesha — Cut My Lawn, Lawn Care Service</title> <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /> HTML after being processed by the sever, with all the tags running together:
HTML Code: <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="description" content="Welcome to Lawn Care Waukesha - Cut My Lawn. Cut My Lawn - Lawn Care Services has offered quality lawn cutting, fertilizing, aerating, and much more at affordable pricing since 2002! We currently offer lawn care service to Waukesha, Brookfield, Pewaukee, Menomonee Falls, and surrounding communities." /><meta name="keywords" content="lawn cutting, lawn mowing, lawn care, fertilizing, aeration, mulching, shrub trimming, lawn mowing, edging, pruning, mulching, weed control, waukesha, Brookfield, Pewaukee, menomonee falls" /><title> Lawn Care Waukesha — Cut My Lawn, Lawn Care Service </title><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
I'm not sure it's relevant, but here's the script used to send the form (which I didn't write, by the way). It's the final tag inside the page head:
HTML Code: <script type="" runat="server"> Protected Sub SubmitForm_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsValid Then Exit Sub Dim SendResultsTo As String = "email" Dim smtpMailServer As String = "smtp" Dim smtpUsername As String = "email" Dim MailSubject As String = "subject" Try Dim txtQ As TextBox = Me.FormContent.FindControl("TextBoxQ") If txtQ IsNot Nothing Then Dim ans As String = ViewState("hf1") If ans.ToLower <> txtQ.Text.ToLower Or ans.ToUpper <> txtQ.Text.ToUpper Then Me.CutMyLawnForm.ActiveViewIndex = 3.......................
I'm rendering a view for the text/plain part of an e-mail. But in some cases, the whitespace is removed between non-output server tags, and I can't figure out why. Can someone explain why the following is missing the line breaks before the final line of output?
[Code]....
But this works - whitespace is preserved between output tags:
[Code]....
This is on MVC 2. It may have been on MVC 1 (or even in Web Forms), but I didn't notice it until today when I went to add a new line to the e-mail, so not sure of the source. Does ASP.NET or MVC have some optimization to try not to output whitespace between server tags?
I have an ASP.net page which contains some controls.
I generate this controls by code, [Actually I have a method which uses a stringBuilder and add Serverside tag as flat string on it]
My page shows the content correctly but unfortunately my controls became like a Client-side control
For example I had a LoginView on my generated code which dosen't work, and also I had read some string from LocalResources which dosen't appear on the page What Should I do to make my generating method correct
Is it possible to access a code behind property for a server tag? I have a property on my code behind page that i want to pass into a javascript function i.e.
I'm doing some databinding inside a ListView ItemTemplate, but I suspect this is a problem for any databinding/template situation. I want to write something like:
How can I acheive that? If it's not possible, what other alternatives do I have? The most important requirement for me is to allow the user to remove the data by clicking on it.
Now, How can I Parse it and render it in RenderContent method ? !!! The following method is always throw the first Exception, it means this.Controls is always empty !!! How can I do it and how I can access to the nested children in RenderControl method ?
public class Menu : WebControl { .... public override void RenderControl(HtmlTextWriter output) { if (!this.HasControls()) throw new Exception("Controls are empty"); .... } }
Adding runat="server" is not rendering my server tags <%...%>
I have a masterpage with a few <li> for menu and since I have to set class=selected for the current page, I am using a little server tag to find the url and assign the particular class.
I have total of 10 <li> and not all menu is available to all types of user, I need to toggle few of the <li> if the user is not admin, so I have runat="server" added to them so I can set their visible=false through c#
The <li> without runat="server" works fine, when on correct page the source code shows class="selected" or class="" as appropriate, the other <li> used to work fine too, until I decided to add the runat="server".
Once I added that runat="server", the whole block of class="" is being sent out to the html page, its not processing the server tags at all! I right click on the html and look at the source, it's being rendered as:
i want make html table in format so i used follwing code but it just print tags(rather than analyze them as html and give appropriate output )
[Code]....
Output got when tried to use TransList.ToString() output got was <html> <head> </head><body><table><tr><td>1</td><td>11/24/2010 12:00:00 AM</td><td>Paypal</td><td>30</td></tr><tr><td>2</td><td>11/24/2010 12:00:00 AM</td><td>Paypal</td><td>300</td></tr><tr><td>3</td><td>12/10/2010 12:00:00 AM</td><td>Paypal</td><td>240</td></tr></table></body></html>
I use these code to show keyword from my data base in metatag  SqlCommand _cmd = new SqlCommand("select Keyword1,Keyword2,Keyword3 from House_info", _cn); _cn.Open(); SqlDataReader _dr = _cmd.ExecuteReader(); while (_dr.Read())
[Code].....
in my page meta tag show above keyword not my keywords from database