Netferrets Online Blog, Internet Related Programming Solutions, Created in C# .net, VB .net, MS SQL Server Javascript, HTML and CSS. Proving sample solutions to problems found when creating web application solutions.
Saturday, 15 June 2013
Evaluate with conditions
if you want to test against a condition and two possible results and return boolean when databinding then this is quite useful. You can also use this is your code behind which makes it look less messy i.e. with anonymous types
<%# Eval("yourfield") == null ? String.Empty : Eval("yourfield")%>
Wednesday, 12 June 2013
Hide a nested repeater with no items
If you want to hide a nested repeater, its quite simple really and useful when you have several repeaters with nested data and the same id. Just be aware that this may need some tinkering around with multiple repeaters.
Add the itemdatabound event and use something along the following lines:
protected void YourRepeater_ItemDataBound(object sender, EventArgs e)
{
Repeater repeater = sender as Repeater;
if (repeater.Items.Count > 0)
repeater.Visible = true;
}
Note: Make sure your nested repeated has visible=false as you dont want it to show if there are no items.
Sunday, 2 June 2013
FIX: A potentially dangerous Request.Form value was detected from the client
If you are having a problem with using a wysiswyg editor for example then this can fix the "A potentially dangerous Request.Form value was detected from the client" error for a specific file/page, this is useful because you don't want to lose the layers of security provided to other pages.
This should be put under in web.config.
<location path="Admin/Pages/EditPage.aspx">
<system.web>
<httpRuntime requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
</location> Hopefully this will help
<system.web>
<httpRuntime requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
</location> Hopefully this will help
Subscribe to:
Posts (Atom)