Posts

Showing posts from 2011

ASP.Net with PHP : Session lost in iframe accessing php page P3P Issue

Image
ASP.Net with PHP : Session lost in iframe accessing php page


Problem: If you have iFrame or multiple frameset in your ASP.NET page, session is lost in the child frame. I have a php app running inside an iframe on an aspx webpage.
I pass a piece of info to this iframe through http parameters, php gets it and then set it in the session.  However, the session data is lost when I click submit button and postback occur in child frame . within the same php application works fine if i do not use iframe.


 ifdisplay.Attributes("src") = "http://191.254.1.42/cmg/upload.php?folder=" & destfolder & "&type=" & ddlType.SelectedValue & "&date=" & txtDate.Text & "&sub=" & txtSub.Text & "&eid=" & Session("eid").ToString & "-" & Request.UserHostAddress.ToString & "&uploadtype=" & Session("uploadtype")
            ifdisplay.Visible =…

ASP.Net: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>)

ASP.Net: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>)

I got this error when I was working on a small AJAX demo project the other day. In this project I only have 1 TextBox controls and 1 AJAX CalendarExtender controls: one text box is for a begin date entry controlled by one CalendarExtender. I had a little javascript in head tag to do some popup work:



<asp:Label ID="lblDate" runat="server" Text="Date (*):" Visible="False"></asp:Label></td><td>                       <asp:TextBox ID="txtDate" runat="server"                        ></asp:TextBox>                     <asp:CalendarExtender ID="CalendarExtender1" runat="server"                          TargetControlID="txtDate">                     </asp:CalendarExtender>
The scrip in head section was :

<script type="te…

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…

Google+ Followers