|
|
|
Follow:
<a href="http://www.c-sharpcorner.com/uploadfile/santhi.m/globalizationusingasp.net11262005072116am/globalizationusingasp.net.aspx">http://www.c-sharpcorner.com/uploadfile/santhi.m/globalizationusingasp.net11262005072116am/globalizationusingasp.net.aspx</a>[<a href="http://www.c-sharpcorner.com/uploadfile/santhi.m/globalizationusingasp.net11262005072116am/globalizationusingasp.net.aspx" target="_blank" title="New Window">^</a>]
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
I want learn asp.net and c# step by step. please give me tips to learn
|
|
|
|
|
The best book for C#:
1. C# 2010 Step by step - beginner
2. C# 4.0 in a nutshell - comprehensive coverage
for ASP.net
1. ASP.NET 4.0 Step by step
2. MCTS 70-515 self paced training kit
3. can't remember the name but a book from WROX P2P series on ASP.NET 4.0.
Some of recommendation:
Microsoft press' MCTS self paced learning kit books are awesome, do read them.
Microsoft press' Step by step series are good for beginners, do read them.
C# 4.0 in a nutshell is pretty good, read it cover to cover.
watch videos on ASP.NET website.
read the MVPs blogs (CP and MSFT)
follow code project daily religiously.
Video Tutorials:
1. "asp.net" official website contains very good videos.
2. "Lynda.com" also has some video series on asp.net but they are from very beginners perspective.
3. "Total Training" has some asp.net 2.0 videos which are pretty awesome to get to intermediate level.
4. I am snot sure about "VTC" but hopefully it might also have some videos on asp.net too.
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
In addition to answer above, CBT Nuggets also has the latest ASP.NET framework covered
The best way to learn any technology is to practice it
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
Hello,
I am trying to display an Excel file in a .aspx page that is opened from the page load event of another .aspx page via a window.open. The HTML of the .aspx page that will display the Excel is as follows...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExcelViewer.aspx.cs" Inherits="ExcelViewer"%>
<!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>Excel Viewer</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
The PageLoad event of the code behind the .aspx page that will display the Excel file includes the following code:
FileInfo fi = new FileInfo(sFilePath);
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = sMIME;
Response.AddHeader("Content-Disposition", "inline; filename=" + fi.Name);
Response.WriteFile(sFilePath);
Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
File.Delete(sFilePath);
What I am finding is that the first time I try to open the Excel file with this code, I get the 'Internet Explorer cannot display the web page...Diagnose connections problems' error page. Then if I try to view the page shortly thereafter the Excel file comes up in the page just fine. Then if I try to view the page a 3rd time I get the error page again...etc. So every other time the viewing is succeeding.
Does anyone have any thoughts as to why this is only succeeding in viewing the Excel file every other time?
Edit: I have found that if my Content-Disposition is set to 'attachment', after receiving the 'Open' or 'Save' prompt and selecting 'Open' the file does open correctly every time in Excel. I would still prefer to use a disposition of 'inline' so the user does not have to be prompted each time a file is to be viewed.
Thank You.
modified 1-Jun-12 12:45pm.
|
|
|
|
|
I am not sure, but something like this has worked fine for me:
Response.AddHeader("content-disposition", "attachment; filename=GExcel.xls");
It could be case case sensitive.
// ♫ 99 little bugs in the code,
// 99 bugs in the code
// We fix a bug, compile it again
// 101 little bugs in the code ♫
|
Tell your manager, while you code: "good, cheap or fast: pick two. "
|
|
|
|
|
Hi...
I Want to show the MS Lync presence status of users in a web page for the corresponding email id's in a gridview.please help me to get this.. Am using VS 2010. Thanks in advance..
|
|
|
|
|
Hi,
Having some problems when clicking on the logout button.
After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application.
I've tried to add the following codes
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page.
Any idea how to solve the logout problem??
Cheers
Berba
modified 1-Jun-12 9:00am.
|
|
|
|
|
Well, you can just check on page load that if user is logged in then display the page.
Otherwise redirect to login page or display alert message that please login.
There is no requirement of
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
Let me know if you have any doubts.
thank you.
Regards
Keyur Satyadev
|
|
|
|
|
when the users log on set a session for your users,
and check session in target pages, and when user log out just remove that session!
Session.Add("userID",ID);
Session.Remove("userID");
for checking session:
if(Session["user"]!=null)
{
}
else
{
Response.Redirect("default.aspx");
}
|
|
|
|
|
|
Try this
- Logout button event:
String pageUrl = "";
pageUrl = Request.Url.ToString();
Session.Abandon();
Response.Redirect(pageUrl);
- And in other page that need session to work try
protected void Page_Init(object sender, EventArgs e)
{
Response.Cache.SetNoServerCaching();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(new DateTime(1900, 01, 01, 00, 00, 00, 00));
}
|
|
|
|
|
When I am stepping though some code in a C#.net 2010 web form application, an exception is thrown saying a 'column name' is invalid. As far as I can tell the dbml property name is spelled the same way it is spelled in the for the column in the specificied table.. I checked the property values for this date column and it is like all the other properties for other date columns in this table.
When I comment out the column in the application, all the of rest of the linq commands work correctly.
Thus can you suggest what I should check to see what is wrong?
|
|
|
|
|
Not without seeing at least some of the pertinent code.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
this kind of error happens sometime in coding, set break point that part commented, and give us some code snippet!
|
|
|
|
|
Can anyone help with this please? I have a webpage with an asp.net frame on it- the frame shows the contents of an html document. When someone clicks on a link in the html document, I need to show some content in another frame on the same page.
So, the question is, what should MyTag be in the following html, so that asp.net server receives an event, with "that" as a parameter, which it then uses to populate another frame on the same page.
<p>to be or not to be, <myTag>that</myTag> is the question</p>
Note that the contents of the frame is html, so it can't contain an asp control. Maybe the answer is some javascript?
Any ideas?
thanks...
|
|
|
|
|
wiins wrote: So, the question is, what should MyTag be in the following html, so that asp.net server receives an event, with "that" as a parameter, which it then uses to populate another frame on the same page.
I think you should edit the question, and find a better way to describe what you wish to achieve.
Will the event just issue a postback to the server?, and what will the event try and do?
|
|
|
|
|
I mean call a method in asp.net. It doesn't matter what the method does, I just need to be able to call it with a parameter.
The only problem I'm concerned with in this question is what I can have in the Html.
To recap- the user sees on the browser some underlined text in html, and clicks on it. I need that to result in a method being called in asp.net.
It's exactly what you could achieve using an asp.net LinkButton, but remember it has to be html.
If you use a LinkButton, then asp.net will convert it to some javascript when it's sent to the browser, so maybe my answer is a bit of javascript?
Is that the best and simplest way?
thanks
|
|
|
|
|
I see things like that in news reports, or wikipedia, in which a term will be presented within an article of explanation, and you can click on that term, to go to a detailed explanation of that term.
I don't know if I'm on the right track here, but this is what I know about it.
Example:
<p>Oligarchy (from <a href="/wiki/Greek_language" title="Greek language">Greek</a> <span xml:lang="grc" lang="grc">ὀλιγαρχία</span> (oligarkhía); from ὀλίγος (olígos), meaning "a few", and ἄρχω (archo), meaning "to rule or to command")<sup id="cite_ref-0" class="reference"><a href="#cite_note-0"><span>[</span>1<span>]</span></a></sup><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span>[</span>2<span>]</span></a></sup><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span>[</span>3<span>]</span></a></sup> is a form of <a href="/wiki/Power_structure" title="Power structure">power structure</a> in which <a href="/wiki/Political_power" title="Political power" class="mw-redirect">power</a> effectively rests with a small number of people. These people could be distinguished by royalty, wealth, family ties, education, corporate, or military control. Such states are often controlled by a few prominent families who pass their influence from one generation to the next.</p>
To the best of my knowledge, the example is created in something like ckEditor, in which the content is composed online, and selected words are highlighted, and a custom control button is clicked to wrap the word with a HTML tag, that provides a pre-selected function or formatting feature.
However, it is done in Javascript, inside the editor during creation. To automatically pick out words, and wrap them in HTML tags, it can be done server side, in which you would have to iterate through the words, find the start and stop of the word position number, and replace the word with an HTML tag wrapped version of the word.
If you need to do it on the server side with raw text, you could check for the word, and do a replace.
if (string.contains("raw word") {
string.replace("raw word", "<a href="word.aspx">raw word</a>)
}
|
|
|
|
|
thanks jkirkerx, this is on the right track- the search and replace stuff I would do on the server as you suggest- the problem is, what do you put as the href? If I wanted to redirect to another aspx page, it would be easy- but what I really need to do here is to return some data from the server based on what the user has clicked.
e.g. supposing in my html, I had this
<a href="#" onclick="myFunction('click this')">click this</a>
then 'click this' would appear as a link in the html, and it would call javascript myFunction, sending in the parameter 'click this'.
I then need to go back to the server (maybe using Ajax??) and get some data, which then needs to be displayed on another container in the same webform, i.e NOT in the container hosting the html file from where it was clicked.
What would the javascript call be?
Just to clarify- I have an asp.net webform which has a container (iFrame or Literal maybe- doesn't matter), which shows the contents of an Html file. The user clicks on the link in the html file, and it has to show some other data *in another container* on the web form.
thanks so far...
|
|
|
|
|
wiins wrote: but what I really need to do here is to return some data from the server based on what the user has clicked.
I would use a span tag because it's inline, and won't change the format of the paragraph text. Many buttons just use a span tag for formatting, and are backed by Jquery or Javascript.
I want to buy a notebook computer today
I want to buy a notebook computer today
Then in JQuery, you add a bind to the class for the click event, pick up the click, get the word, transmit it via $.Ajax to the Web Service, get a response back, figure out what to do.
[Code]: the code is just for conveying the concept, it does not work.
$(document).ready(function () {
initiateBinding();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
});
function EndRequestHandler(sender, args) {
initiateBinding();
}
function initiateBinding() {
$('.specialWord').click(function () {
var theWord = $(this).html();
var newPage = runWebService(theWord);
window.location = newPage
$(this).empty();
$(this).appendTo("new text");
return false;
});
}
function runWebService(theWord) {
[edit]: window.location = "newpage.aspx";
return newPage;
[3rd edit] take the response, and populate the container using .empty() .appendTo(" la la la"") to the new container.
var newText = objB.newText;
$('newContainer).empty();
$(newText).delay(250).appendTo($('newContainer'));
}
Like I said, just an idea of one way to do it on the client side, with web services on the server side to make decisions.
modified 8-Jun-12 17:09pm.
|
|
|
|
|
I am getting the following error while editing values in a GridView row.I am posting my code and error below.
Error:
'cmbGender' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomerData.aspx.cs" Inherits="CustomerData" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Code,Type" ShowFooter="True"
OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand"
OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewName" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Gender" SortExpression="Gender">
<EditItemTemplate>
<asp:DropDownList ID="cmbGender" runat="server" SelectedValue='<%# Eval("Gender") %>'>
<asp:ListItem Value="Male" Text="Male"></asp:ListItem>
<asp:ListItem Value="Female" Text="Female"></asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="cmbNewGender" runat="server">
<asp:ListItem Value="Male" Text="Male"></asp:ListItem>
<asp:ListItem Value="Female" Text="Female"></asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Gender") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" SortExpression="City">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewCity" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("City") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="State" SortExpression="State">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("State") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewState" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("State") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Type" SortExpression="Type">
<EditItemTemplate>
<asp:DropDownList ID="cmbType" runat="server" DataTextField="Type" DataValueField="Type">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("Type") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="cmbNewType" runat="server" DataTextField="Type" DataValueField="Type">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="LinkButton3" runat="server">AddNew</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class CustomerData : System.Web.UI.Page
{
CustomersCls customer = new CustomersCls();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillCustomerInGrid();
}
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList cmbType = (DropDownList)e.Row.FindControl("cmbType");
if (cmbType != null)
{
cmbType.DataSource = customer.FetchCustomerType();
cmbType.DataBind();
cmbType.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values[1].ToString();
}
}
if (e.Row.RowType == DataControlRowType.Footer)
{
DropDownList cmbNewType = (DropDownList)e.Row.FindControl("cmbNewType");
cmbNewType.DataSource = customer.FetchCustomerType();
cmbNewType.DataBind();
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
FillCustomerInGrid();
}
private void FillCustomerInGrid()
{
DataTable dt = customer.Fetch();
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
else
{
dt.Rows.Add(dt.NewRow());
GridView1.DataSource = dt;
GridView1.DataBind();
int TotalColumns = GridView1.Rows[0].Cells.Count;
GridView1.Rows[0].Cells.Clear();
GridView1.Rows[0].Cells.Add(new TableCell());
GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
GridView1.Rows[0].Cells[0].Text = "No Record found";
}
}
}
Please help me to solve this error.Thanks in advance
|
|
|
|
|
mudunurusv wrote: <asp:DropDownList ID="cmbGender" runat="server" SelectedValue='<%# Eval("Gender") %>'>
<asp:ListItem Value="Male" Text="Male"></asp:ListItem>
<asp:ListItem Value="Female" Text="Female"></asp:ListItem>
</asp:DropDownList>
Error must be here.
You have defined two values for this dropdown - Male & Female.
Based on the error, your datasource field "Gender" at some time has any other value than above two. May be empty! Check what all values are coming.
|
|
|
|
|