Tuesday, November 09, 2010

Blooper on Google Fast Flip

Just check the link, Google FastFlip has a blooper.

What happened actually (in my opinion) is that Google has an application that opens URL and takes pictures of the desktop and saves them in there fastflip. So in this blooper the website gave a popup, and as Machine is a Machine even though it was a computer with an application running on it.

This blooper is of News mentioned below.
Technology Review by Lauren Gravitz in Sci/Tech

And page is 7th, so you have to go right 7 times.


Enjoy IT ;)

Tuesday, April 20, 2010

Anchor in HTML controls in ASP.NET

I had to make a new menu in an ASP.NET web app. but the problem that i faced was how to use "~" to reference the root, if i had folders inside the root with pages.

So the solution is

< a href=" < % = Page.ResolveUrl("~/Common/DB/ViewRecords.aspx") % > " > < / a >

Enjoy IT!

Wednesday, March 24, 2010

2 Combo box in gridview asp.net

The gridview on the aspx page.

DataSourceID="SqlDataSource1" ShowHeader="true">


/>


AppendDataBoundItems="true" DataTextField="SupplierName" DataValueField="SupplierId"
AutoPostBack="true" SelectedValue='<%# Bind("SupplierId") %>'>





[]







ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM vInvoiceDetailProduct"
UpdateCommandType="Text" UpdateCommand="UPDATE InvoicesDetails SET INVOICEDETAILID=INVOICEDETAILID WHERE 1=2"
DeleteCommandType="Text" DeleteCommand="DELETE FROM InvoicesDetails WHERE INVOICEDETAILID=@INVOICEDETAILID">

ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="select ProductId, ProductName from cds.products">

ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="select DISTINCT S.SupplierId, SupplierNumber, SupplierName from cds.suppliers S INNER JOIN CDS.PRODUCTS P ON S.SUPPLIERID = P.SUPPLIERID ORDER BY SupplierName">



the code behind event handlers
Private Sub GridView2_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView2.PreRender
If Me.GridView2.EditIndex <> -1 Then
Dim C1 As Control = GridView2.Rows(Me.GridView2.EditIndex).FindControl("cmbSuppliers1")
Dim D1 As DropDownList = CType(C1, DropDownList)

Dim C2 As Control = GridView2.Rows(Me.GridView2.EditIndex).FindControl("cmbProducts1")
Dim D2 As DropDownList = CType(C2, DropDownList)

If Not D2 Is Nothing Then
Dim ds As DataSet
ds = New DB().SelectQuery("select ProductId, ProductName from cds.products WHERE SUPPLIERID = " + D1.SelectedValue.ToString)
D2.DataSource = ds.Tables(0)
D2.DataTextField = "ProductName"
D2.DataValueField = "ProductId"
D2.DataBind()
End If
End If
End Sub

Private Sub GridView2_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView2.RowUpdating
Dim C1 As Control = GridView2.Rows(e.RowIndex).FindControl("cmbSuppliers1")
Dim D1 As DropDownList = CType(C1, DropDownList)
Dim C2 As Control = GridView2.Rows(e.RowIndex).FindControl("cmbProducts1")
Dim D2 As DropDownList = CType(C2, DropDownList)
Try
Dim db As New DB
Dim id As String = CType(GridView2.Rows(e.RowIndex).Cells(1).Controls(0), TextBox).Text
Dim qty As String = CType(GridView2.Rows(e.RowIndex).Cells(3).Controls(0), TextBox).Text 'GridView2.Rows(e.RowIndex).Cells(2).Text
Dim price As String = CType(GridView2.Rows(e.RowIndex).Cells(4).Controls(0), TextBox).Text 'GridView2.Rows(e.RowIndex).Cells(3).Text
db.InvoicesDetailsEdit(id, D2.SelectedValue, qty, price)
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub


This should get you going with this.

Enjoy IT!

Windowless control error

In some applications, when you use an external activex control, it gives you an error that the app does not support windowless controls…

So the solution is to goto project properties -> Compile -> Build Events then in Post-Build event command paste this

call "$(DevEnvDir)..\..\VC\bin\vcvars32.bat"
call "$(DevEnvDir)..\..\VC\bin\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"


This will make that control work in Run Time, but still it will give error on debug mode, so for debugging you have to use message box or labels and write error log or event log.
But it will make it work at the end.

Enjoy IT!