Hi, sorry i'll try and explain it better with an example. Say i have the following string:
string text = "<strong>Blah</strong> <a href="test.com">test</a>
<script>alert('test');</script>";
I want to allow the strong tag but encode the script tag. Therefore i do the...
Hi, i'm trying to make my website more secure by encoding any output i display. However i still want to allow some html tags.
I am using a wysiwyg editor with only bold, italic and underline enabled. I enter my text in the wysiwyg and click submit, the data is then inserted into the database...
Hi, i'm trying to create my own pager control. I've built very basic web controls in the past but this one is the first where i have had to handle events. So far i have:
public class PagerCommandEventArgs : CommandEventArgs
{
public int Page { get; set; }
public...
Hi, i've always taken security for granted in my websites but i am currently in the process of building a big website where security is of major importance. I understand most of the server side security concerns such as sql injection but with javascript (and ajax) i get a little bit lost. From...
Hi, I'm trying to make my site more search engine friendly by correctly handling 404 error pages. I have the following in my web.config file:
<customErrors mode="RemoteOnly" defaultRedirect="~/Error/500.htm">
<error statusCode="500" redirect="~/Error/500.htm"/>
<error statusCode="404"...
Hi, i can't seem to use databinding syntax within the LayoutTemplate of the ListView control. I have tried:
<%# SomeProperty %>
but this does not work. In the past i was able to do this fine within the HeaderTemplate of a Repeater control. I modified the above to:
<%= SomeProperty %>
but...
Hi i have the following code within a user control to build a table:
protected int RowCounter
{
get
{
object o = this.ViewState["RowCounter"];
return o != null ? (int)o : 0;
}
set
{
this.ViewState["RowCounter"] = value;
}
}
protected void...
Hi, none of the above work:
PageSize='<%# Globals.Settings.Content.News.MaximumRows %>' - runs but is simply ignored
PageSize='<%= Globals.Settings.Content.News.MaximumRows %>' - error "Cannot create an object of type 'System.Int32' from its string representation '<%=...
Hi, I have a couple functions to return the position of a tag. I'm hoping i can then use this to position an absolute positioned tag on top of this tag. However since this returns the position from the edge of the browser, if i have a parent element which has relative positioning the element...
Hi, maybe i'm just being picky/lazy but i'm trying to set the PageSize of my DataPager (which sits within the LayoutTemplate of my ListView). I tried doing:
PageSize="<%# Globals.Settings.Content.News.MaximumRows %>"
and i received no errors but it simply ignored it. I thought the...
This definately looks like a bug. I added the following:
<asp:NextPreviousPagerField ShowFirstPageButton="false" ShowLastPageButton="false" ShowNextPageButton="false" ShowPreviousPageButton="false" />
To the Fields part of the DataPager and it seems to have done the trick.
Cheers again for...
Hi cheers, I've been looking at the template pager field but it appears as though there is a bug with it. I tried:
<asp:DataPager ID="pager" runat="server" PageSize="1" QueryStringField="Page">
<Fields>
<asp:TemplatePagerField>
<PagerTemplate>
<%#...
Hi, i'm trying to use the DataPager control and i have two problems:
1. It uses the the physical url and not actual url, ie default.aspx instead of default.htm (i use isapi rewrite to rewrite the url)
2. I can't see how i can customize the way the paging works. I can see there is a...
Hi cheers for your help NeilTrain. I am coming from a php background. I like c# and the compiler can be great but something as simple as division often become abit of a mess.
Hi, i haven't been programming in c# for long and was wondering how i could rewrite the code below to be alot nice:
int width = 100;
int height = 130;
float ratio = (float)image.Width / (float)image.Height;
if ((float)width / (float)height > ratio)
width = (int)Math.Round((float)height *...
Hi, cheers for your advice. I don't think i can get around the sub query problem but i will take that into consideration in the future. I removed the function and simply replaced it with the attributes i wanted and it dramatically improved the performance. Thanks for your help.
Hi, my database has the following tables:
Sections:
- SectionID (PK)
- SectionName
Documents:
- DocumentID (PK)
- SectionID (FK)
- Title
Attributes:
- AttributeID (PK)
- SectionID (FK)
- AttributeName
My site is split into sections ie News, Events etc (stored in the sections table). Each...
Hi, i am building a website which requires my users to upload lots of images. I feel this could clog up the server in terms of bandwidth and space.
I was wondering if i could use a third party website to upload my images too via a developer api. However i don't have much experience in this...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.