Posts

Showing posts from April, 2010

Dynamically populate the list view control in asp.net

If you want to populate your list view in runtime according to query then here is the code.
Make changes in following files
Web.config<connectionStrings><addname="vinConn"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\intradb.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient" />connectionStrings>Databaseconn.vb in app_codeImports System.Data.ServicesImports System.LinqImports System.ServiceModel.WebImports Microsoft.VisualBasicImports System.DataImports System.Data.SqlClientPublicClass databaseconn' TODO: replace [[class name]] with your data class name' Inherits DataService(Of [[class name]])PublicShared connection AsNew SqlConnection( System.Configuration.ConfigurationManager.ConnectionStrings("vinConn").ConnectionString
EndClass
Dynamicdatabinding.vb in App_codeImports System.Data.ServicesImports System.LinqImports System.ServiceModel.WebImports Microsoft.Visua…

c:\fakepath html 5 havoc

I used asp.net visual web developer 2010 to upload files. I got error due to c:\fakepath in asyncfileupload control. Many of you face following problem:
IE8 upload control shows "c:\fakepath\" c:\fakepath - how to workaound this?C:\fakepath is shown in the attach files dialogue when selecting or typing the path to the attachment to be uploaded on ie8 or windows 7
The reason is The C:\Fakepath is specified in HTML 5, so maybe all borwsers that implement this specificaten may hide the real file path. new security features in IE 8 the file upload will not report the real file path to the control unless you add the page to the trusted site collection of the IE. Instead the “c:\fakepath” is shown to the JavaScript that handles the file upload information. There is no error in your code. This is just to trouble the web developers. Even google chrome doesn't support this.
Solution is : you go to Internet Explorer; Tools; Internet Option; Security; Custom; find the "Include lo…

asp.net Gridview date format & truncating hyperlink field

in asp.net web application you can choose the Gridview date format by modifying your select query. eg. to get date in dd.mm.yyyy format make your query like this.
Session("CurrentQuery") = "SELECT sub, filename, convert(varchar, cdate, 104) as cdate from circulars ORDER BY cdate DESC"
Now you can modify the convert function as follows
convert(varchar, yourtablecolumnfield, 100) as yourtablecolumnfield - mon dd yyyy hh:mmAM (or PM) convert(varchar, yourtablecolumnfield, 101) as yourtablecolumnfield - mm/dd/yyyy - 10/02/2008 convert(varchar, yourtablecolumnfield, 102) as yourtablecolumnfield - yyyy.mm.dd as yourtablecolumnfield - 2008.10.02 convert(varchar, yourtablecolumnfield, 103) as yourtablecolumnfield - dd/mm/yyyy convert(varchar, yourtablecolumnfield, 104) as yourtablecolumnfield - dd.mm.yyyy convert(varchar, yourtablecolumnfield, 105) as yourtablecolumnfield - dd-mm-yyyy convert(varchar, yourtablecolumnfield, 106)…

button on different panel doesn't fire

validation group
I had 3 tabs. in each tab there was 3 text box with required field validator and a submit button.submit button in tab1 was working fine, but not working in tab2.
solution is assign validation group for everycontrol in each tab, like
open tab1, press ctrl key and select all controls i.e. text box, validator,button etc.
now go to property window and choose validation group
now type here a groupname like "tab1" or ur name etc.
these all control will bind with same validation group,, do same thing for other tab and controls.
thus validation group delimits the scope of all control to that particular tab.

"Invalid argument" when switching tabs in tabControl

"Invalid argument" when switching tabs in tabControl

I have an ajax tab control and 5 tab panels in it. I am using some AsyncFileUpload controls inside updatepanel in all tabs.the AsyncFileUpload control produces this error when switching Tabs in the TabControl. Everything is inside an UpdatePanel.The Error that is highlighted in the code will be this:

a._innerTB.style.width=a._inputFile.offsetWidth-107+"px";


to resolve this issue i have to switch asyncfileupload visibility to off when switching tab..
visible only those who are in active tab..
ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="497px" Width="755px" OnClientActiveTabChanged="ActiveTabChanged" AutoPostBack="true"
do this in page load event Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then 'this will be executed only f…

.docx not working in web page for users

Downloading Office 2007 documents from IIS 6or Downloading .exe softwares from IIS 6I made the site in asp,.net vwd 2010 and uploaded a Microsoft Office 2007 document to a IIS6.0 server and it not being able to serve it or allow the user to view it. When user access.. it gives 404 file no found error... while file was still accessible through FTP....IIS 6.0 probably doesn't know what the new Office 2007 file extensions are. IIS 6.0 is Secure By Design. This means that MIME types are in a white list. Everything that isn’t known to the server is hidden by default and thus returns a 404 error. This is an easy problem to solve. You just need to add the new MimeMaps to IIS 6.0. The new maps are as follows:

.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template
.potx application/vnd.openxmlformats-officedocument.presentationml.template
.ppsx application/vnd.openxmlformats-officedocument.…

UpdatePanel not working with ToolkitScriptManager

When u use scriptmanager with updatepanel then it's fine.But when u add ToolkitScriptManager for any ajax control like extender, then page wont run because there are two scriptmanager.So if u delete scriptmanager then UpdatePanel will not work with ToolkitScriptManager.
To resolve this issue, only use ToolkitScriptManager because it has scriptmanager as parent.make following changes in your code. just add property "ChildrenAsTriggers="true""
lt&&;@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" % gt&&;
...........
lt&&;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ChildrenAsTriggers="true" gt&&; lt&&;/asp:ToolkitScriptManagergt&&;

How to insert data from Form using sql express and visual web developer 2008

Image
Here is a simple method to insert data dynamically from Form using sql express and visual web developer 2008.It uses just a query as parameter then perform the insert job easily.
The example has a file upload control and text box.we will only pick the absolute file name and content of textbox to insert them in database named "test" when cilck on submit button. This code doesnt upload the file , to that look for my other blog.
Step 1 . In ur vb/ vc code page type this at top of page
Imports System.DataImports System.Data.SqlClient
Step 2. In aspx page make 4 controls inside update panel control a file uploader, a text box and 3rd submit button and label to show errors. like this

Step4. Write the code inside submit button click event like this
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click Dim TheFile As String If (AsyncFileUpload2.HasFile) Then TheFile = Strings.LCase(Replace(System.IO.Path.GetFileNa…

How to insert Form records in MS Access database using asp.net

Image
First of all give full access permission to all database .mdb files by right click> properties> permissions
Make a function
Function insertRecord(ByVal mysql As String) As Boolean Dim DBconn = New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "DATA SOURCE=" & Server.MapPath("") & "\database\circulars.mdb;") Dim DBcmd As New OleDb.OleDbCommand(mysql, DBconn) Try
DBcmd.Connection.Open() DBcmd.ExecuteNonQuery() DBcmd.Connection.Close() insertRecord = True

Catch exc As Exception
DBcmd.Connection.Close() Span1.InnerHtml = "Error: Unable To Submit Circular : Please Contact IT Dept
" & exc.Message()
insertRecord = False End Try
End Function
You can call this function by getting data from Form like this at submit button click event.
Dim mysql As String = "Insert Into circulars ( cno, cdate,cdate…

Google+ Followers