.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Dynamically getting db name from another page

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

Hello Everyone.... I currently have this code on my page_load event handler and i am trying to figure out if i can put it on another page and call it from there. I have a lot of sql statement on codebehind and when i try to move from dev to prod... i encounter problems a little... Is there a way out... thanks


If Not Page.IsPostBack Then

Dim connString As

View Complete Post

More Related Resource Links

dynamically add record in page


I am creating page dynamically using this. I want to read the file, which is dynamically created and show content on page from database like 40 record in each page.

String root = Server.MapPath("~");
        String pgTemplate = root + "\\myPageTemplate.tmp";
        StringBuilder line = new StringBuilder();        
        using (StreamReader rwOpenTemplate = new StreamReader(pgTemplate))
            while (!rwOpenTemplate.EndOfStream)

        int ID = 0;
        string SaveFilePath = "";
        string SaveFileName = "";
        Random ran = new Ran

Creating asp.net page dynamically

Hi All:  I have a requirement that I need to create asp.net page dynamically for each folder inside a specific folder. I know the code to traverse each folder but I don't know how to create a new page dynamically and show the contents. Please help me on this.   Regards,  Asif HameedHi All: I have a requirement that I need to create asp.net page dynamically for each folder inside a specific folder. I know the code to traverse each folder but I don't know how to create a new page dynamically and show the contents. Please help me on this.  Regards, Asif Hameed

Dynamically change the page footer height

Hi, I want to dynamically change the page footer height based on a condition? Is that possible?   Thanks in Advance  

Urgent- How to show sequential workflow on asp.net web page dynamically

Hi All,My basic question is how can we show a sequential workflow diagram on asp.net web page dynamically. using WWF can we do this?. i have gone throgh the some of forums/articles but i could not find right information anywhere. please suggest me the right path to achieve this.

Rearrange dynamically visible controls on a page

Hello,Here is what I am trying to do.I have a drop down list along with a 'Add' button (which are always visible). There are some other 'Label', 'TextBox', 'Button' in the page (which is not visible on load). Depending on the user selection from the first dropdown (and when click on 'Add' button), I would like to dynamically set some of the Controls visible.For example (as per below code): When User selects 'Email' ... Label3, TextBox3 and Button3 will be visible. Again when user will click Button3, all controls will be invisible. I was able to Show and Hide those controls as per user selection and button click. What I would like to do is, rearrange the controls. For example, If user selects 'Email' and click 'Add' button (Button5), It would display 'Label3', 'TextBox3', 'Button3'. Then if user selects 'Name' from the dropdown and click 'Add' button again, it would display 'Label1', 'TextBox1', 'Button1' below the Email controls. As of now it is apperaing on sequence as listed in html (Name controls always come first when visible, then 'Phone', then 'Email'). I would like to display the controls as sequesnce as user selects.And next is when we will click the Button3 (which will hide the email controls), All other controls below email co

How to set the heading of aspx page dynamically?

Hi,I would like to set the page heading according to the querystring value.So, it is something like this:From Page1.aspx I am redirecting to Page2.aspx.In Page1, I have list of image buttons depicting different Departments coming from database.On clicking the particular Image button I will be redirected to Page2.aspx which shows info regarding to that department.Page1.aspx code:<asp:ImageButton ID="imgbtnProject" runat="server" PostBackUrl='<%#GetUrl(DataBinder.Eval(Container.DataItem,"DeptId")) %>' ImageUrl='<%#String.Format("{0}{1}","images/Depts/",Eval("ImagePath"))%>'/>Page1.aspx.cs, GetUrl() method:protected string GetUrl(object ProjectId) { return string.Format("~/Page2.aspx?DeptId={0}", DeptId); }Now, I want to reset the page heading of Page2.aspx,depending on the Department,so, it should be:MyProject-Accounts,MyProject-Marketing etc.It is having master pages as well.Please suggest me how to do that.

Dynamically added text boxes disappears after page refresh


Dim objDatabase As New database
        Dim objAdapter As SqlDataAdapter
        Dim objDataset As New DataSet
        Dim objAdapter1 As SqlDataAdapter
        Dim objDataset1 As New DataSet
        Dim objAdapter2 As SqlDataAdapter
        Dim objDataset2 As New DataSet

        objAdapter = New SqlDataAdapter("SELECT first_name + ' ' + last_name as [Name],father_mobile_no as [Father Mob No],mother_mobile_no as [Mother Mob No] FROM student_data WHERE class='" & cmb_class.SelectedValue & "' and division = '" & cmb_division.SelectedValue & "' and school_id='" & Session("school_id") & "'", objDatabase.con)
        objAdapter.Fill(objDataset, 0)
        If objDataset.Tables(0).Rows.Count > 0 Then

            Dim dt_table As DataTable

How to create a Table of content in .rdl design in BIDS dynamically according to the Page no wise..?



well i am able to create the TOC statically by using the Document Map properties as describe in my older post issue 

but now i just want to create the Table of contents dynamically generate using the page no wise..is it possible...how can we do it while designing the .rdl in BIDS..



Using HttpModule to change master page dynamically on SharePoint 2010 site


I am trying to change master page dynamically on SharePoint 2010 site. I reviewed some documents (SharePoint: Dynamically Change Master Page: http://ranaictiu-technicalblog.blogspot.com/2009/10/sharepoint-dynamically-change-master.html) and I implemented IHttpModule, added it to GAC, modified web.config(safecontrol, httpmodule, module)
It works good! But I found some problems
1.Never catch the PreInit event for publishing pages
2."/_Layouts/RedirectPage.aspx" page occurred error
3.ContextMenu did not work

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using Microsoft.SharePoint;
using System.Configuration;
using Microsoft.SharePoint.ApplicationRuntime;

namespace MasterUtilModule
    public class MasterModule : IHttpModule
        public void Dispose() { }
        public void Init(HttpApplication context){

Dynamically Loaded UserControl, receiving the click event from UserControl to Parent Page



   In a page , when I click a button 'showDialog' I am loading the user control dynamically in a dialog.  I am linking to the event in the user control as explained below. The parent page is not receiving this event.

  ex: (This is in the page class)


         UseControl1 gc = dlg.LoadContent(:\UserControl1.csx);

        gc.CausePostback += new EventHandler(execute_CausePostback());



   // I am trying to update the details grid in parent page


In UserControl class after clicking the submit button


  raise event CausePostBack();


Any help is appreciated.



Dynamically adding content to page outside of the aspnet form from within a UC


I have a uc which generates a html form  that should auto-submit when the browser loads the page, so I need to add the form to the page before the </body> tag - outside the asp.net form, id like my UC to work without having any requirements on its parent page / masterpage.

i have managed to add a literal inside the body tag by calling the following inside CreateChildControls on the parent page
Me.Form.Parent.Controls.AddAt(0, ltl)
however this required the body to have runat="server" and the code to be added to the user control's parent page. ( this also seems to cause the viewstate to be lost after postback)

Is there any way i can append the string to the rendered html inside the body but outside the <form></form> from within the UC code

Incase it makes a difference the UC is being added dynamically to the page.

How can I change the CSS file used in Master Page dynamically?


I am thinking that it would be better to use multipe CSS files and change them within the master page dynamically than it would be to use multiple master pages (basically one master page for each page, which defeats the purpose of the master page).

However, I do not know how to make a change to the master page before a standard apsx page that is derived from it is loaded.

How to index a page that uses jquery to dynamically load

I have an html page that dynamically loads content using jquery.  After the page initially renders, it takes 1-2 seconds for the data to be populated from the javascript.  As a result, the Sharepoint indexer is not able to "see" any of this dynamic content and it is not searchable.  Are there any workarounds for this? 

How to dynamically generate aspx Page

How to dynamically generate aspx page that should have dynamic name; for exam. "~/the-name-of-the-article.aspx" and dynamic 
html inside (content of the article)?  The page needs to be integrated in the master page.  
Default page generated from master page "Site.master":
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master"   AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
I tried  this way, but doesn't work?
    protected void Button1_Click(object sender, EventArgs e)
        Page page = new Page();
        string article = "name-of-the-article";

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend