protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
// Make sure we aren't in header/footer rows
if (row.DataItem == null)
{
return;
}
DetailsView dv = (DetailsView)row.FindControl("DetailsView1");
List<[object]> aList = List<[object]>();
if (e.Row.RowType == DataControlRowType.DataRow)
{
aList[e.Row.RowIndex].Name = aList[e.Row.RowIndex].Name;
dv.DataSource = aList.Where(u => u.ID == Convert.ToInt32(aList[e.Row.RowIndex].Address)).ToList();
dv.DataBind();
}
}
Monday, January 27, 2014
Binding Nested Detailsview in Gridview
Wednesday, December 25, 2013
Using Htmlframe tag instead of Iframe tag
I recently was working on a project where I had to use an Iframe. This Iframe would get querystring parameters and pass it to the associated page in the Iframe. Now, if your using a standard .aspx page, you won't need this tip. This tip if for people that are using Iframes in their controls. Since controls use System.Web.UI.UserControl and not the standard System.Web.UI.Page that pages use. You won't be able to use the standard Iframe tag. Instead you'll need to use the server Iframe version. Before using this server tag, you'll need to add the snippet below to your web.config in the controls section. Then add the following snippet in your control. Hope this was helpful!
<controls> <add assembly="System.Web" namespace="System.Web.UI.HtmlControls"
tagprefix="asp"/> </controls>
<asp:HtmlIframe frameborder="0" height="650" id="myiframe" name="myiframe" runat="server" src="prefcontent.aspx" width="400"> </asp:HtmlIframe>
Monday, September 23, 2013
Converting WordPress from Windows to Apache Server Error
Recently I was
working with a charity that had a WordPress site running on a Windows server. The owner decided to change it to an Apache server. After the conversion he noticed that none of his child pages where linking. It displayed a very vague error which could have most people changing things they don't need to touch. In the snippet below, you'll see the code that needs to be changed in your root .htaccess file. You can basically copy the whole thing and paste it over what's currently in that file. Happy Coding! ☺
# BEGIN WordPressErrorDocument 404 /index.php?error=404 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress
Monday, July 8, 2013
How to Send an Email With App Setting in Web Config File.
A few years ago I was thinking about converting some of my settings to be accessed in one place. The other day a happened to run across this example that displays exactly how I approached it back then. The problem was, back then there wasn't the resources available like there are today. This example is strait to the point and will get you on the right path. You can also incorporate any additional settings like this example into your config file as well. CODE EXAMPLE
Happy Coding!!!! ☺
Happy Coding!!!! ☺
Monday, July 1, 2013
Creating a JQuery Alert for a Specific Date or Date Range
Recently, one of my clients needed an alert to display changes to one of their processes. They needed it to display every time a user visited the page until it reached a specific date. In the example below I've created a basic Javascript function that allows you to enter a start date, end date and return type. For example, after you've added your start and end date you want to either put in weeks, days, hours, minutes or seconds into the interval property. Next, create a JQUERY function that will call the datediff and display an alert dialog with the content you've assigned which in this case is a div that has an id of "alertDate".
//START HEAD SECTION
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet"></link>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
function datediff(fromDate, toDate, interval) {
var second = 1000, minute = second * 60, hour = minute * 60,
day = hour * 24,week = day * 7;
fromDate = new Date(fromDate);
toDate = new Date(toDate);
var timediff = toDate - fromDate;
if (isNaN(timediff)) return NaN;
switch (interval) {
case "years": return toDate.getFullYear() - fromDate.getFullYear();
case "months": return ((toDate.getFullYear() * 12 + toDate.getMonth())
-
(fromDate.getFullYear() * 12 + fromDate.getMonth()));
case "weeks": return Math.floor(timediff / week);
case "days": return Math.floor(timediff / day);
case "hours": return Math.floor(timediff / hour);
case "minutes": return Math.floor(timediff / minute);
case "seconds": return Math.floor(timediff / second);
default: return undefined;
}
}
$(function () {
var curDate = new Date();
var alertDate = new Date();
alertDate.setDate(alertDate.getDate() +
datediff(curDate, alertDate, 'days'));
if (alertDate.toDateString() >= curDate.toDateString()) {
$("#alertMsg").dialog({
height: 500,
width: 650,
modal: true
});
}
});
</script>
//END HEAD SECTION
//START BODY SECTION
<div id="alertMsg" style="background-color: #f5fa64;" title="IMPORTANT NOTIFICATION!!">
<h2 style="font-size: 30px; margin: 0; text-align: center;">
ATTENTION!!</h2>
This is a custom alert that will continue to display until the current date time is greater or equal to
the current date time.
</div>
//END BODY SECTION
Subscribe to:
Posts (Atom)