Saturday, August 22, 2009

Radio button in datagrid

Radio buttons will not work by default inside a datagrid. The selection will be individual, because the groupname/id of the control is going to be different for each role automatically. Hence we need to make use of the literal control.

1. Insert literal control instead of the radiobutton control into the datagrid
2. The idea is to find the literal control inside the datagrid
3. Replace it with a radio button control with a fix name.

Something like:

if (e.Row.RowType == DataControlRowType.DataRow)
{
Literal literal = (Literal) e.Row.FindControl("RadioButtonMarkup");
literal.Text = String.Format("<input type='radio' name='couponId' id='coupon{0}' value='{0}' />", e.Row.RowIndex);
}

Friday, August 21, 2009

Datagrid ASP.NET C#

Inside the datagrid, insert a template column with the checkbox name chkSelect. The next column should be the ID of the column you want to obtain information from.

protected void btnModify_Click(object sender, EventArgs e)
{
for (int i = 0; i < couponGrid.Rows.Count; i++)
{
GridViewRow row = couponGrid.Rows[i];
bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;
if (isChecked)
{
// Column 2 is the ID column
String accessId = couponGrid.Rows[i].Cells[1].Text;
lbl.Text = lbl.Text + "haha" + accessId;
}
}
}
}

Eval("info") Eval of HTML fields in C#

If you try manipulating Eval binding tags within HTML, chances are you are not able to and you will get nasty errors. The only way to do it is to handle the process via a method. For example:

<asp:checkbox id="chkSelect" runat="server" checked="'<%#">' />

public bool checkOrNot(object id)
{
return true;
}

Thursday, August 20, 2009

Database

Select IDENTITY of the record after you insert, the XSD way.

Within the XSD file, create a new query -> create new standard procedure -> Select insert -> add a select query after the insert query, something like:

INSERT INTO [coupon] ([memberId], [categoryId], [couponCode], [couponName], [couponImage], [couponVideo], [couponSMSText], [couponExpiration], [couponDisclaimer], [couponPrice], [couponDiscount], [couponStart], [couponEnd], [couponLimit], [couponCreationDateTime], [couponStatus]) VALUES (@memberId, @categoryId, @couponCode, @couponName, @couponImage, @couponVideo, @couponSMSText, @couponExpiration, @couponDisclaimer, @couponPrice, @couponDiscount, @couponStart, @couponEnd, @couponLimit, @couponCreationDateTime, @couponStatus);SELECT couponId FROM coupon WHERE (couponId = SCOPE_IDENTITY())

After that, select the property of the query and select SCALAR mode instead of NonQuery

Tuesday, August 18, 2009

XAMPP PHP INI modifying

The only PHP.ini file that really matters is the one found in /apache/bin/php.ini.

Sunday, August 16, 2009

Pipe Problems

Gbeacon server has SQL Server Configuration Manager
http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx