|
What do you mean by setting up IIS?
|
|
|
|
|
serima nazarian asked: How should I view this page on a browser? I mean what should I do to make it available from a browser to everyone?
I'm suggesting that in order for people to view your page in a browser you have to set up IIS (Internet Information Services)
The publication process in Visual Studio just creates a viable directory structure which you can then use with IIS in order actually make it available to people and so you can see it in a browser and not have to run it through Visual Studio.
|
|
|
|
|
|
Hi
I am using .Net 3.5 .I am using trying to create a Master detail relationship using gridview with LinqDataSource control. I am using northwind database with Categories and Products table.
For every Categoryid, I want to display the corresponding Product details.
I am getting an error which is shown below.
Here is the full code:
<asp:LinqDataSource ID="categoriesLinqDataSource" runat="server"
ContextTypeName="NorthwindDataContext"
Select="new (CategoryName)"
TableName="Categories">
</asp:LinqDataSource>
<asp:LinqDataSource ID="productsLinqDataSource" runat="server"
ContextTypeName="NorthwindDataContext"
Select="new (ProductID, ProductName, CategoryID, UnitPrice,
UnitsInStock, Discontinued)"
TableName="Products"
Where="CategoryID == @CategoryID">
<WhereParameters>
<asp:Parameter Name="CategoryID" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
<br />
<asp:GridView ID="grdcategories" runat="server" AutoGenerateColumns="False"
DataSourceID="categoriesLinqDataSource"
onrowcreated="grdcategories_RowCreated">
<Columns>
<asp:BoundField DataField="CategoryName" HeaderText="CategoryName" />
<asp:TemplateField HeaderText="Products">
<ItemTemplate>
<asp:GridView ID="grdproducts" runat="server"
AutoGenerateColumns="False"
DataKeyNames="ProductID"
DataSourceID="productsLinqDataSource">
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void grdcategories_RowCreated(object sender, GridViewRowEventArgs e)
{
var ctx = new NorthwindDataContext(); //Northwind.dbml class
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridView innergridview = e.Row.Cells[1].FindControl("grdproducts") as GridView;
var cat = ctx.Categories.Single(c => c.CategoryName ==
grdcategories.DataKeys[e.Row.DataItemIndex].ToString());
productsLinqDataSource.WhereParameters["CategoryID"].DefaultValue = cat.CategoryID.ToString();
innergridview.DataSource = productsLinqDataSource;
}
}
error: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Could anyone pls let me know what's wrong?</pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre><pre></pre>
|
|
|
|
|
Hi, thanks for looking
I have this site wich had cookieless sessions enabled for the session and for the forms authentication
I decided to disable cookieless sessions, but the problem now is that googles search engine has a lot of links with the sessionid embeded, i tought that just by disabling the cookieless session in the webconfig people clicking on those links would get a page not found, and since i have a custom page for the pageotfound error, weverything would be fine, but i just realizaed that cookiless sessions are still working
Whas the best way to not allow anyone to navigate my site with the session is embeded in the url??
Thanks in advance for any feedback
Alexei Rodriguez
|
|
|
|
|
Redirect the request to your error page if the requested url contains the session parameter.
This can be easily accomplished with an HttpModule in ASP.NET.
|
|
|
|
|
Hi coders,
I am working in .NET Framwork 3.5 rightnow. I am using "asp:fileupload" control to upload files on server on one of my page. but what's happening is: first I select any file through 'FileUpload' control, then when my page goes through "PostBack" event (that is when I change something else after selecting file), the <asp:fileupload xmlns:asp="#unknown"> control is reset to its null value and at submit I am not getting any file to save.
Please help me to understand if I am missing something.
Thanks,
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
Fileupload control will not persist value across postbacks. User need to select the file again.
|
|
|
|
|
Any chance that your asp:FileUpload control is placed within an asp:UpdatePanel control? If so, you will need to add some code to accomodate the Ajax postback.
Do a search on ASP FileUpload and UpdatePanel and you will find numerous solutions that will work.
|
|
|
|
|
Hi everybody . Our management wanted to write Codes with C#.Net I againsted him I said VB is better than C#.Net Which program language is better. What is the most important diffrences, avantage or disadvantage between c# and vb.Net. Do you have any advice and any documant and webpages?
|
|
|
|
|
souravghosh18 wrote: I againsted him I said VB is better than C#.Net
And your reasoning for this was what?
souravghosh18 wrote: Do you have any advice and any documant and webpages?
At the end of the day it is down to personal preference. There are no real differences between C# and VB.NET other than the syntax of the language. There is nothing in one language that you absolutely cannot do in the other. One language may make one thing slightly easier in a certain scenario, yet in a different scenario the situation is reversed.
When you add that up it comes to about 100 or so things that I'd count as differences. The thing that they share, the .NET framework, has over 110,000 methods. So, if you learn one language then you are also learning many of the methods that are available. Want to work in the other language, then just learn the syntactic differences - the methods and classes will remain the same.
So, my question to you is once again - Why do you think one is better than the other? What reasons did your management give for their view?
|
|
|
|
|
You could read this: http://support.microsoft.com/?kbid=308470[^]
I think the two basic issues in deciding between those languages are:
- productivity, how well people in the group handle the language they use
- value of the investment in the future, making programs is an investment. How well it will hold it's value in the future. Will there be more VB programmers available than C# programmers or vice versa and so on
So hardly it's about one being better than the other as a language (although there are few things that currently can't be done using VB). However, a project can mix languages: An application written in VB can use a dll written in C#.
|
|
|
|
|
Hi There,
I have a popup window through witch I am adding new coutry,state,city detail.I had also done validation for this popup window through javascript to prevent postback.It is showing error messages properly.but after that popup window disappears immediatly because of postback.
What I want to do is I want to show this poup window to user after error occure also.Is there any method in javascript to prevent post of button.If anybody knows please help.I am using Asp.net 2.0 and C#.Net
Thanks,
|
|
|
|
|
through JavaScript return false on 'ButtonClick' when error occours
|
|
|
|
|
Thanks For Reply,
Can you please explain little more.
Thanks
|
|
|
|
|
I have a gridview that I am populating with data based on user values in a textbox from the code behind. I have the gridview working correctly upto the point of displaying relevant data, making the selected row editable when the 'edit' link next to the corresponding row is clicked and cancelling the editable row so that reverts back to display mode. The problem is updating. How do I save the changes made to a specific row in edit mode once I hit the update link. My code is as follows:-
1 public partial class UserLockouts : System.Web.UI.Page
2 {
3 public SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["xyz"].ConnectionString);
4 public static int uniqueStoreId = 0;
5 public static int storeId = 0;
6 public static int userId = 0;
7 protected void Page_Load(object sender, EventArgs e)
8 {
9
10 }
11
12 protected void btn_Search_Click(object sender, EventArgs e)
13 {
14 bindGridView();
15 }
16
17 protected void bindGridView()
18 {
19 if (tb_UniqueSN.Text != string.Empty)
20 {
21 conn.Open();
22 string strSQL = "SELECT [StoreId] FROM [ac_StoreSettings] WHERE ([FieldValue] ='" + tb_UniqueSN.Text + "')";
23 SqlCommand cmd = new SqlCommand(strSQL, conn);
24 Object myData = cmd.ExecuteScalar();
25 uniqueStoreId = Int32.Parse(myData.ToString());
26 storeId = uniqueStoreId;
27 conn.Close();
28 }
29
30 else if (tb_StoreID.Text != string.Empty)
31 {
32 storeId = Int32.Parse(tb_StoreID.Text);
33 }
34
35 else if (tb_UserID.Text != string.Empty)
36 {
37 conn.Open();
38 string strSQL = "SELECT [UserId], [IsLockedOut] FROM [ac_Users] WHERE ([UserId] =" + Int32.Parse(tb_UserID.Text) + ")";
39 SqlCommand cmd = new SqlCommand(strSQL, conn);
40 DataTable dt = new DataTable();
41 SqlDataAdapter sqlAdapter = new SqlDataAdapter(null, conn);
42 sqlAdapter.SelectCommand = cmd;
43 sqlAdapter.Fill(dt);
44 conn.Close();
45 try
46 {
47 grd_Users.DataSource = dt.DefaultView;
48 grd_Users.DataBind();
49 pnl_Users.Visible = true;
50 }
51 catch (Exception ex)
52 {
53 AuctivaUtils2.AuctivaLogger.WriteErrorEntry(ex.Message, AuctivaUtils2.eAuctivaLogFile.General);
54 }
55 finally
56 {
57 conn.Close();
58 }
59 }
60
61 if (storeId != 0)
62 {
63 conn.Open();
64 string strSQL = "SELECT [UserId], [IsLockedOut] FROM [ac_Users] WHERE ([StoreId] ='" + storeId + "')";
65 SqlCommand cmd = new SqlCommand(strSQL, conn);
66 DataSet ds = new DataSet();
67 SqlDataAdapter sqlAdapter = new SqlDataAdapter(null, conn);
68 sqlAdapter.SelectCommand = cmd;
69 sqlAdapter.Fill(ds);
70 conn.Close();
71 try
72 {
73 grd_Users.DataSource = ds;
74 grd_Users.DataBind();
75 pnl_Users.Visible = true;
76 }
77 catch (Exception ex)
78 {
79 AuctivaUtils2.AuctivaLogger.WriteErrorEntry(ex.Message, AuctivaUtils2.eAuctivaLogFile.General);
80 }
81 finally
82 {
83 conn.Close();
84 }
85 }
86 }
87
88 protected void grd_Users_RowEditing1(object sender, GridViewEditEventArgs e)
89 {
90 grd_Users.EditIndex = e.NewEditIndex;
91 bindGridView();
92 }
93
94 protected void grd_Users_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
95 {
96 grd_Users.EditIndex = -1;
97 bindGridView();
98 }
99
100 }
101 }
The markup for my gridview is as follows:-
1 <asp:panel id="pnl_Users" runat="server" visible="False" xmlns:asp="#unknown">
2 <asp:gridview id="grd_Users" runat="server">
3 onrowediting="grd_Users_RowEditing1" AutoGenerateEditButton="True"
4 onrowcancelingedit="grd_Users_RowCancelingEdit">
5
|
|
|
|
|
Cyberpulse wrote: How do I save the changes made to a specific row in edit mode once I hit the update link.
You need to handle that event. Write queries to update the database and renind the grid.
Since you are new to CP, when you post code, try to wrap it in <pre></pre> tags and indent the lines. The code which you posted in less readable.
|
|
|
|
|
I have a gridview that i need to grab the record id from when the end user clicks on the link to take them to the next page.
Is there anyone that can help me accomplish this?
Here is my entire code behind if that helps.. its getting frustrating since my demo is today at 4pm and i cant get this working.. thanks for any help anyone can offer..
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class GR_Intranet_Apps_Compliance_app_Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GridView1.Visible = false;
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink hl = e.Row.FindControl("HyperLink1") as HyperLink;
DataRowView drv = e.Row.DataItem as DataRowView;
if (drv["formtype"].ToString() == "VC")
{
hl.NavigateUrl = "vc_form.aspx";
}
else if (drv["formtype"].ToString() == "FS")
{
hl.NavigateUrl = "edits/fs_form_edit.aspx";
}
else
hl.NavigateUrl = "dg_form.aspx";
}
Session["sessid"] = e.Row.FindControl("record");
}
protected void GridView1_SelectedIndexChanged(object sender, GridViewSelectEventArgs e)
{
Session["sessid"] = GridView1.SelectedRow.Cells[0].Text;
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["sessponum"] = (ponum.Text);
Session["sessuser"] = Request.ServerVariables["AUTH_USER"];
GridView1.Visible = true;
}
}
|
|
|
|
|
And what is happening? Do you get any exceptions? You're frustrated and time is short but you have to give a little more you expect any help.
only two letters away from being an asset
|
|
|
|
|
I am creating classes from an xsd file using xsd.exe.
For some reason, an additional property is being generated for all elements and attributes in the generated object model.
For example, I have a "General" element (class property) and when I set a QuickWatch in my debugger, an additional property is displayed at the same level named "generalField." "General" has a child element defined through a complex type sequence named "CreatedBy." In the QuickWatch, an additional property named "createdByField" is displayed.
Is there a way to configure my xsd or xsd.exe command so these additional "field" properties are not displayed?
|
|
|
|
|
This is probably a very simple question, but I'm working on my first ASP.NET application. I want to use the response.redirect function to send my application back to the start of the website. The main page of the site is default.aspx.
I tried, Response.Redirect("/") , but that put me too far back and did not include my virtual path.
The proper path should be something like this: http://myserver/vpath/default.aspx
What is the proper way of redirecting back to the home page ?
Thanks.
|
|
|
|
|
Hi
Did you try Response.Redirect("~/") ? or simply Response.Redirect("~/default.aspx") ?
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook
|
|
|
|
|
Just use
Response.Redirect("Default.aspx");
And when you want to refer to sub folder then either use "./FolderName/FileName" or "~/FolderName/FileName" (like the previous poster suggested)
|
|
|
|
|
That will not work if the current folder is not the root.
|
|
|
|
|
Yes, but he has specified http://myserver/vpath/default.aspx and Response.Redirect("/") . And I dont think he has pages in the sub folders.
|
|
|
|