Posts

Showing posts from November, 2011

Advertisement.

TransHimalaya.in

Everest Helicopter Tour for a day

Book exciting packages at www.transhimalaya.in

ASP.net : Listview datakeynames for multiple sql staements in SqlDataSource's update command

ASP.net : Listview datakeynames for multiple sql staements in SqlDataSource's update command
I am using two tables in listview. I have to update both tables simultaneously after update. To do this
1. use multiple sql update statement in sqldatasource update command seperated by ;
2. set datakeys property to primary key of both tables seperated by comma ,

Example:


<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:entertrackConnectionString %>" 
                        InsertCommand=" INSERT INTO contact_master (uid, eid, cell, email, dept, desig, name, rax, off, resid) values ( @uid, @eid, @cell, @email, @dept, @desig, @name, @rax, @off, @resid ) ;
INSERT INTO contact_detail (eid, assign, field1, uid) values ( @uid, @assign, @field1, @uid )" 
                        ProviderName="<%$ ConnectionStrings:entertrackConnectionString.ProviderName %>" 
         …

ASP.Net: How To Close Modalpopup And Refresh Parent Page

I've a parent page with a long form. I am opening ajax modal popup extender on the click of a link button.

Default.aspx

[Code]....

In login.aspx, I've another  form. When the submit button is clicked, I am doing some processing, after that need to close the modal popup window and refresh my parent page, without disturbing the session  already created in parent page.

login.aspx
[Code].... Parent.Page.Response.Redirect("default.aspx")
Solution: Earlier i was using iframe to load the login.aspx inside modal popup. Now i have switched to another concept of converting webform to control. As follows:  To convert a code-behind ASP.NET Web page into a user controlRename the .aspx file so the file name extension is .ascx.Rename the code-behind file to have the file name extension .ascx.vb or .ascx.cs, depending on what programming language the code-behind file is in.Open the code-behind file and change the class from which it inherits from Page to UserControl.In the .aspx file, d…

IE z-index bug with CSS dropdown menu

IE z-index bug with CSS dropdown menuStandards-aware web designers generally know of thez-index bugin all versions of Internet Explorer (though, version 8 is rumored to fix it).In the W3C’s specs, z-index is designed to affect the stacking order of positioned elements on a web page. So, an element with a z-index of 2 should always appear above an element with a z-index of 1. In Internet Explorer, this doesn’t work like it should. Internet Explorer resets the stack when the positioned elements are separated from each other.
It works fine with IE8, FF etc. However IE7 has a problem to show submenus. It shows the submenu but when I try to navigate in the submenu, it fades out.
The FixThe fix for this is very simple, but there are incredibly large websites that use jumbled masses of iframes, extra divs, and other horrors to get Internet Explorer to display the dropdowns above the offending elements.
For a fix, we use the following CSS for the header div. See the screenshot for an example of …

ASP.net Scope_Identity () equivalent for mysql, LAST_INSERT_ID()

I've looked all over for this answer and had to resort to several resources.  I wanted to post this here because it was so hard for me to find a simple example.  If it exist other places then please excuse my post and put references to it on a reply. So, How do I return the Primary Key Identity when I click the control with the 'Insert' command on a FormView? (With very least minimal code)  get the ID - the primary key - of the newly inserted row when adding a new record to the database using a FormView Control on a web page
With SQL Server we do it like this : (Add new insertparameter ID with direction output)   <asp:SqlDataSource ID="SqlDataSource1" runat="server"              ConnectionString="<%$ ConnectionStrings:entertrackConnectionString %>"               ProviderName="<%$ ConnectionStrings:entertrackConnectionString.ProviderName %>"  InsertCommand="INSERT INTO training_ppm ( descr, organizer, dt_st, dt_end, venue…

Crystal Report: Passing url parameter value to Report

I want to pass parameter value to crystal report through url like
reports.aspx?pid=55


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim theReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        theReport.FileName = "C:\inetpub\wwwroot\prims\reports\training.rpt"
  'theReport.SetDatabaseLogon(PCON.APP.UserName, PCON.APP.Pass, PCON.APP.db_Server, PCON.APP.dbName)


  'Set the required parameter for Crystal Report
        theReport.SetParameterValue("pid", Request.Params("pid"))


  'Now, present report in PDF format
        ' theReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, False, "ExportedReport")
        CrystalReportViewer1.ReportSource = theReport


    End Sub


rpt file is having a parameter value pid . If you dont pass pid in url then it will prompt for value as usual...

Crystal report; Combining rows of data into a single value

Crystal report; Combining rows of data into a single value or

Concatenate Column Values from Multiple Rows into a Single Column

I have two field like this

field1  field2
1         a@xyz.com
2        b@xyz.com
3         c@xyz.com
4         d@xyz.com


I wanted output like:
a@xyz.com , b@xyz.com, c@xyz.com, d@xyz.com


Solution

In Report header put a formula @initializeVar which will work as global variable:


WhilePrintingRecords;
StringVar Conc_emailID := "";

In Group Header or Detail Section (Wherever u want) put a formula @updateVar to concatenate the cell value of each row:


WhilePrintingRecords;
StringVar Conc_emailID := Conc_emailID + {tablename.field2}+ ',' ;

In Report Footer finally access the concatenated value from variable by putting a formula field @showVar :


WhilePrintingRecords;
StringVar Conc_emailID;


It will give you the desired output.
- Vinod Kotiya





ASP.Net Gmail like multiple/single file upload with defined limit size

Create upload.aspx. Here is the aspx page and scripts;


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="upload.aspx.vb" Inherits="upload" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Uploader</title>
    <script language='Javascript' type="text/javascript">
      function addFile() {
            var ni = document.getElementById("fileDiv");
            var objFileCount = document.getElementById("fileCount");
            var num = (document.getElementById("fileCount").value - 1) + 2;
            objFileCount.value = num;
            var newdiv = document.createElement("div");
            var divIdName = "file" + num + "Div";
            newdi…

Google+ Followers