Monthly Archives: December 2010

Refresh TreeView after insert/update/delete ?

Wrong solution : DataBind() BEFORE close()         TreeView1.DataBind()         con.Close() Right solution: In btnListtAdd_Click :   To get the ID         Dim lastID As String = “Select @@Identity”         Dim getID As Integer         ‘this is to get last ID … Continue reading

Posted in Databases, Programming, SQL-Server, VB.NET | Tagged , , , , , | Leave a comment

Hide a GridView Column

If GridView1.Columns(0).Visible = False there will be an error: Index is out o range. Solution: GridView1.DataBind() If GridView1.Columns.Count > 0 Then         GridView1.Columns(0).Visible = False Else         GridView1.HeaderRow.Cells(0).Visible = False         For Each gvr As GridViewRow In GridView1.Rows                 gvr.Cells(0).Visible … Continue reading

Posted in ASP.NET, Programming | Tagged , , | Leave a comment

Customize image to fit into the page

Sometimes the image width is bigger than the page. So to set it in pagelayout , alter the attributr size like this: style=”width: 890px;” will control this. <asp:Image ID=”Banner” runat=”server” ImageUrl=”~/images/bannar.jpg”                             style=”width: 890px; vertical-align:middle; text-align:center;” /> The div width … Continue reading

Posted in ASP.NET, Programming | Tagged , , , , | Leave a comment

Read PDF from a Database and Open it into a Frame

IHttpHandler is aowsome. You read your file in the buffer and just send it to src as if it is a named file, so no need to read and save a temporary file in client’s PC. iframePDF1.Attributes.Add(“src”, “ShowPDF.ashx?pID=” & Request.QueryString(“pID”)) … Continue reading

Posted in Databases, Programming, SQL-Server, VB.NET | Tagged , , , , , | Leave a comment

2010-2020 Decade of the Developers

1990 to 1999: the decade of innovations PCs Networks Printers emails the Net , web , internet 2000 to 2010: deploy technologies , training users and built data centers 2011 to 2020: apps and who build apps? Developers. Applications are … Continue reading

Posted in 2011, 2011-2020, History, Predictions | Leave a comment

How to open a new page/window and send parameters by clicking a button?

Because neither Server.Transfer nor Response.Redirect has an option to open a new page/window , this is a workaround: Failed Solutions: I thought this is a Smart solution <asp:Button ID=”OpenNewPage” runat=”server” Text=”Open New Page” OnClientClick =”document.forms [0].target = ‘_blank’;“/> But it … Continue reading

Posted in JavaScript, Programming | Tagged , , | Leave a comment

Error msg: No mapping exists from object type System.Data.SqlClient.SqlParameter to a known managed provider native type.

        Dim pID As New SqlParameter(“@ID”, SqlDbType.Int)         pID.Value = TextBoxParentID.Text         cmd.Parameters.AddWithValue(“@ID”, pID) I changed it to:         Dim pID As New SqlParameter(“@ID”, SqlDbType.Int)         pID.Value = TextBoxParentID.Text         cmd.Parameters.Add(pID) and it works also this works:         Dim pID … Continue reading

Posted in Databases, Programming, SQL-Server, VB.NET | Tagged , , , , , | 3 Comments

ExecuteReader vs ExecuteNonQuery vs ExecuteScalar

ExecuteReader() For SELECT statement ExecuteNonQuery() For INSERT , UPDATE and DELETE Not for SELECT statement. ExecuteScalar() For images   Ahmed.

Posted in Comparison, Databases, Programming, SQL-Server, VB.NET | Tagged , , , , , , , , , | Leave a comment

CKEditor – a Free Web Text Editor in ASP.NET

Download CKEDITOR  from http://ckeditor.com/download In your asp.net page and in header tag add : <head> <script type=”text/javascript” src=”ckeditor/ckeditor.js”> </script> <script type=”text/javascript”>      window.onload=function()      {      CKEDITOR.replace(‘TextBox1’);      }  </script>  </head> Then in body tag replace TextBox instead of textarea … Continue reading

Posted in free software, Rich Text Editor | Tagged , | 1 Comment

Error Msg: Server Error in ‘/folder‘ Application … A potentially dangerous Request.Form value was detected

Error Msg: Server Error in ‘/folder‘ Application … A potentially dangerous Request.Form value was detected Solution: Add ValidateRequest=”false” to the <% Page tag for example if you already have: <%@ Page Language=”vb” AutoEventWireup=”false” Codebehind=”MyForm.aspx.vb” Inherits=”Proj.MyForm”%> then this should become: <%@ … Continue reading

Posted in ASP.NET, Programming | Tagged , , , | Leave a comment