Friday, August 28, 2009

Remove a row from datatable

Below is the method to remove a row from datatable based on the conditions
Dim flag As Boolean = False
Dim dtTem As New DataTable
dtTem = dt.Clone()
dtTem.Clear()
' Dim dtrow As DataRow

For Each row As DataRow In dt.Rows
For Each col As DataColumn In dt.Columns
If row(col).ToString.Trim = "" Then
flag = True
ElseIf IsNumeric(row(col)) AndAlso CInt(row(col).ToString.Trim) = 0 Then
flag = True
Else
flag = False
Exit For
End If
Next
//If there is the data, add tht row to datatable
If flag = False Then
'dtrow = dtTem.NewRow()
'dtrow = row
dtTem.ImportRow(row)
End If
Next


Return dtTem

Thursday, August 27, 2009

Removing Columns in DataTable

http://www.codeasp.net/articles/asp.net/113/removing-columns-in-datatable-

Friday, August 21, 2009

Ajax Module Popup Box

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnCancel"
TargetControlID="btnPopup" PopupControlID="pnlTrackingNr" PopupDragHandleControlID="PopupHeader"

Drag="false" BackgroundCssClass="ModalPopupBG">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlTrackingNr" Style="display: none" runat="server" HorizontalAlign="Center"
Width="300px" Height="50px" BackColor="WhiteSmoke" BorderColor="#659FD9" BorderWidth="2px" BorderStyle="solid">
<div>
<div id="PopupHeader" style="background: #91B7E7; border-color: #659FD9; color: White;">
<b>Please Confirm</b></div>
<div class="Controls">
<table id="tblWarehouses" width="100%">
<tr valign="top">
<td>
<asp:Label ID="lblWarning" runat="server" CssClass="displayfont"></asp:Label>
</td>
</tr>

<tr>
<td colspan="2">
<asp:Button ID="btnYes" Text="Yes" runat="server" CssClass="button" OnClick="btnYes_Click" />
<input id="btnCancel" type="button" class="button" value="No" />
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>

Thursday, August 20, 2009

SQL Transactions

This Blog tells you about SQL Sql Transaction

http://www.4guysfromrolla.com/webtech/080305-1.shtml

Monday, August 10, 2009

Add character in between using OnKeyPress event

<script language="javascript" type="text/javascript">

function padCharacter(Cid,ch,num)
{
var elem = document.getElementById(Cid);
var pad = elem.value;
if(!ch) ch="";
if(pad.length == num)
{
pad=pad +ch;
elem.value=pad;

}


}


</script>

txtPlantJob.Attributes.Add("onkeypress", "padCharacter('" + txtPlantJob.ClientID + "','-',2)")

Pad Zeros to the left In textBox Asp.Net

<script language="javascript" type="text/javascript">

function padLeft(Cid,ch,num)
{
var elem = document.getElementById(Cid);
var pad = elem.value;

if(!ch) ch="";
while(pad.length < num)
{
pad = ch+ pad;
elem.value= pad;
}



}


</script>


In Code Behind:
On Page Load Call

txtCustItemNr.Attributes.Add("onblur", "padLeft('" + txtCustItemNr.ClientID + "','0',10)")

Infragistics Initalize row

These are some of the basics stuffs, which can be used to format Infragistics Web Grid Columns:


Protected Sub iggrdJobInvSts_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs)

If e.Row.Cells(10).Value <> "" Then
e.Row.Cells(14).Value = Convert.ToDateTime(e.Row.Cells(10).Value).ToShortDateString
End If

e.Row.Cells(8).Value = CInt(e.Row.Cells(8).Value.TrimStart("0"))

End Sub