|
//It is for Upto Windows XP and Server 2003.
Right click on your project in iis--> Propertis --> Documents Tab --> Click on Add Button --> Write Your Start up page name with extention. --> Make it as first item in the list by clicking on up arrow. --> Click on OK.
// Windows 7 and above
Select your project, you will find some options in the middle pane. You will identify the DefaultDocument option. Double click on that, it will open a dialog then write your Start up page name with extention. Autometically it will shows the page in first position.
|
|
|
|
|
right click on webpage ---select set as startup page that's it by defalt websites on server run by index.aspx/default.aspx/home.aspx
|
|
|
|
|
I would like to use your color trackbar in a vb.net app. Will I've done a fair amount of coding with vb.net I have not tried to incorporate a C resource such as your color trackbar. Can you or another reader help me?
You can email be directly if you want:
carlferguson@bellsouth.net
Thank you very much.
Carl
|
|
|
|
|
Exactly who are you addressing this question to?
|
|
|
|
|
Not a good idea to post your email address. Also, what is the color trackbar? Be more specific.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi,
I am new in ASP.NET c# web application development. I am creating a simple Account Management application. I am experiencing an error when using QueryString to pass value to a form. I have a main form named WebForm1.aspx. When I click a button named View List, it will pop-up a separate window with a gridview displaying all the account from a SQL database. The new window is called frmList.aspx, the gridview has a button on each row, and when I click the button it should transfer the data from the row to several textbox in the first page, WebForm1.aspx. But after I click the button it gives me an error. Below is the code behind for frmList.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (ClassProj.GetDBconn() == true)
{
String SQLstr = "SELECT a.ID, a.NAME AS Name,b.NAME AS Industry,a.subindustry as SubIndustry,a.geo AS Geo,c.NAME AS LocType FROM mpsacct AS a,industry AS b,location AS c WHERE a.industry=b.id AND a.loctype=c.id";
MySqlCommand cmd = new MySqlCommand(SQLstr, ClassProj.mycon);
MySqlDataReader reader = cmd.ExecuteReader();
grdAll.DataSource = reader;
grdAll.DataBind();
reader.Close();
cmd.Dispose();
}
ClassProj.CloseConn();
}
public void MPS_Selected(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
int index = Convert.ToInt32(e.CommandArgument);
string name = grdAll.Rows[index].Cells[1].Text.ToString();
string Industry = grdAll.Rows[index].Cells[2].Text.ToString();
string SubInd = grdAll.Rows[index].Cells[3].Text.ToString();
string geo = grdAll.Rows[index].Cells[4].Text.ToString();
string location = grdAll.Rows[index].Cells[5].Text.ToString();
Page.Response.Redirect("WebForm1.aspx?name=" + name + "&industry=" + Industry + "&subind=" + SubInd + "&geo=" + geo + "&location=" + location);
}
}
|
|
|
|
|
I see a lot of issues but I am not sure if any are the actual error.
1. You likely need to check for Page.IsPostBack() in your Page_Load event and only DataBind when it is not a postback.
2. When you Respone.Redirect go to the root. So, do Response.Redirect("~/WebForm1.aspx") or whatever the path is. 404 means the page cannot be found.
3. URLEncode your parameters in case they have spaces or other special characters.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Thanks!I will try those changes. I am not sure what Page.IsPostBack() but I will do a research on that.
Thanks!
|
|
|
|
|
There are a lot of controls in .Net which cause postbacks. For example a button when clicked and even dropdowns, although you can control it. So, you normally only want to retrieve your data when the page loads for the first time, not when controls are causing a postback. So, in Page_Load check if (!IsPostBack()) then do your select.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I tried your suggestions but, this time everytime I click the select button it still gives me the same error. Here is the code behind from the WebForm1.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
namespace AccoutMgt
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.Request.QueryString["name"] != null)
{
txtMPSname.Text = Page.Request.QueryString["name"];
txtLoc.Text = Page.Request.QueryString["location"];
DlstGeo.DataValueField = Page.Request.QueryString["geo"];
}
}
protected void BtnSearch_Click(object sender, EventArgs e)
{
}
}
}
and here is the code from frmList.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
namespace AccoutMgt
{
public partial class List : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (ClassProj.GetDBconn() == true)
{
if (!IsPostBack)
{
String SQLstr = "SELECT a.ID, a.NAME AS Name,b.NAME AS Industry,a.subindustry as SubIndustry,a.geo AS Geo,c.NAME AS LocType FROM mpsacct AS a,industry AS b,location AS c WHERE a.industry=b.id AND a.loctype=c.id";
MySqlCommand cmd = new MySqlCommand(SQLstr, ClassProj.mycon);
MySqlDataReader reader = cmd.ExecuteReader();
grdAll.DataSource = reader;
grdAll.DataBind();
reader.Close();
cmd.Dispose();
}
}
ClassProj.CloseConn();
}
public void MPS_Selected(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
int index = Convert.ToInt32(e.CommandArgument);
string name = grdAll.Rows[index].Cells[1].Text.ToString();
string Industry = grdAll.Rows[index].Cells[2].Text.ToString();
string SubInd = grdAll.Rows[index].Cells[3].Text.ToString();
string geo = grdAll.Rows[index].Cells[4].Text.ToString();
string location = grdAll.Rows[index].Cells[5].Text.ToString();
Page.Response.Redirect("~/WebForm1.aspx?name=" + name + "&industry=" + Industry + "&subind=" + SubInd + "&geo=" + geo + "&location=" + location);
}
}
}
}
|
|
|
|
|
Is WebForm1 in the root of the site? That is what the ~ does. It puts you to the root so make sure that Response.Redirect(path) is correct.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
They are located on the same path. The WebForm1.aspx is the start page and serves as the parent. The frmList.aspx is a pop-up window. Basically what should happen is the frmList.aspx will call back the WebForm1.aspx and pass the values to the controls of WebForm1.aspx.
Thanks,
|
|
|
|
|
I know, but is WebForm1 under a folder? Or is it at the root of your site?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
It's in the root of the site. I'm not sure where the problem is, since when I run the debug it does not go anywhere when I click the button in the GridView. Here is the ASP code of the GridView at frmList.aspx
<asp:GridView ID="grdAll" runat="server" OnRowCommand="MPS_Selected" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="ID" HeaderText = "" Visible="false" />
<asp:BoundField DataField="Name" HeaderText = "MPS Account Name" />
<asp:BoundField DataField="Industry" HeaderText = "Industry" />
<asp:BoundField DataField="SubIndustry" HeaderText = "Sub-Industry" />
<asp:BoundField DataField="Geo" HeaderText = "Geo" />
<asp:BoundField DataField="LocType" HeaderText = "Location" />
<asp:buttonfield buttontype="Button" commandname="Select" headertext="" text="Select"/>
</Columns>
</asp:GridView>
|
|
|
|
|
404 means it cannot find the file. So, put a breakpoint and see what url it is trying to go to. Also, if the url is correct try adding the Everyone group to the folder with full control because you may have an issue where file level security is preventing IIS from seeing the file.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi,
Where do I do that in the file? Sorry for the questions, I am very new to this. I just started a week ago. And I am stuck on finding a way of passing back a value from a page to it's parent page.
Thanks,
|
|
|
|
|
Can you post a screen shot of the file structure maybe?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
This is the method that I use to show a new window, I'm not sure what is wrong but it won't work anymore
protected void btnAll_Click(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("window.open('frmList.aspx', 'MPS Account List',");
sb.Append("'top=0, left=0, width='500', height='700', menubar=no,toolbar=yes,status,resizable=yes,addressbar=yes');<");
sb.Append("/script>");
Type t = this.GetType();
if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript"))
ClientScript.RegisterClientScriptBlock(t, "PopupScript", sb.ToString());
}
|
|
|
|
|
Hey, have you debugged through your code and seen where it exactly crashes? place breakpoints in each function and see what exactly is the problem. Like the app could be failing because the url is incorrect, or it might be trying to parse out a value that is not there from your querystring. Anyway find out exactly where its crashing and il gladly help you.
|
|
|
|
|
Yes, I placed some breakpoints, but when I click on the button where it will pop-up a window it won't stop on the breakpoint..here is the code for the pop-up window and the code for the passing back the value from the gridview to the parent page.
//code for pop-up window
protected void btnAll_Click(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("window.open('frmList.aspx', 'MPS Account List',");
sb.Append("'top=0, left=0, width='500', height='700', menubar=no,toolbar=yes,status,resizable=yes,addressbar=yes');<");
sb.Append("/script>");
Type t = this.GetType();
if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript"))
ClientScript.RegisterClientScriptBlock(t, "PopupScript", sb.ToString());
}
//code for passing value back
public void MPS_Selected(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script type='text/javascript'>alert('msg!')</script>");
int index = Convert.ToInt32(e.CommandArgument);
string name = grdAll.Rows[index].Cells[1].Text.ToString();
string Industry = grdAll.Rows[index].Cells[2].Text.ToString();
string SubInd = grdAll.Rows[index].Cells[3].Text.ToString();
string geo = grdAll.Rows[index].Cells[4].Text.ToString();
string location = grdAll.Rows[index].Cells[5].Text.ToString();
Page.Response.Redirect("~/WebForm1.aspx?name=" + name + "&industry=" + Industry + "&subind=" + SubInd + "&geo=" + geo + "&location=" + location);
}
}
|
|
|
|
|
may be you can use
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('msg!')");
show you info.the Response when you jump another page,that can
use.
did you ?
|
|
|
|
|
what should I put on the 'msg!'? when the place this code on the method it only pop's up msg on the messagebox.
Thanks!
|
|
|
|
|
'msg!' mean info you want to put on this pleace!
string
try{}catch{} this things that all you can put on it!It loooks like UI page
javascript alert(""); Hope can help you
|
|
|
|
|
Hi everybody,
I want to check username entered is already available in sqlserver 2008 database. can anyone help me?
Thanks for any help in Advance
Regards
Anu Koshy
|
|
|
|
|
My SQL skills are almost non-existent, but surely querying for a particular name in a username list or table, will tell you whether it exists or not. Probably some form of
SELECT * from usertable WHERE username = 'name to test'
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|