Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

How to use Sitemappath control to add breadcrumbs in Master Page of a website?

$
0
0
I am trying to add breadcrumbs on my web pages for easy navigation. For this I am using SiteMapPath Control of Asp.Net and along with this I have also made a breadcrumb.Sitemap file which list all the pages. But While implementing the sitemappath in my master page, I am getting a generic error. I am not able to understand why is this happening?
This is the basic structure of my aspx page-
<divid="menu-pt"><divclass="hm"><ahref="Page1.aspx"class="active">Home</a></div><divid="nav"><ulid="nav"name="nav"><li><ahref="Page2.aspx">Page2</a></li><divclass="saparation"></div><li><ahref="Page3.aspx">Page3</a></li><divclass="saparation"></div><li><ahref="Page4.aspx">Page4</a></li><divclass="saparation"></div><li><ahref="#">Pages</a><divid="Ul2"runat="server"><ulid="sub-nav"><li><ahref="Page5.aspx">Page5</a></li><li><ahref="Page6.aspx">Page6</a></li><li><ahref="Page7.aspx">Page7</a></li><li><ahref="Page8.aspx">Page8</a></li></ul></div><divid="Ul1"runat="server"><ulid="sub-nav"><li><ahref="Page9.aspx">Page9</a></li><li><ahref="Page10.aspx">Page10</a></li><li><ahref="Page11.aspx">Page11</a></li><li><ahref="Page12.aspx">Page12</a></li><li><ahref="Page13.aspx">Page13</a></li></ul></div></li></ul></div></div>
<li>Page5,6,7,8.aspx pages is for all users. And <li>Page9,10,11,12,13.aspx pages are for logged in user.
And My breadcrumb.sitemap file is-
<?xmlversion="1.0"encoding="utf-8"?><siteMapxmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"><siteMapNodeurl="Page1.aspx"title="Home"description="Page1"><siteMapNodeurl="Page2.aspx"title="Page2"description="Page2"/><siteMapNodeurl="Page3.aspx"title="Page3"description="Page3"/><siteMapNodeurl="Page4.aspx"title="Page4"description="Page4"/><siteMapNodeurl=""title="Pages"description=""><siteMapNodeurl="Page5.aspx"title="Page5"description="Page5"/><siteMapNodeurl="Page6.aspx"title="Page6"description="Page6"/><siteMapNodeurl="Page7.aspx"title="Page7"description="Page7"/><siteMapNodeurl="Page8.aspx"title="Page8"description="Page8"/><siteMapNodeurl="Page9.aspx"title="Page9"description="Page9"/><siteMapNodeurl="Page10.aspx"title="Page10"description="Page10"/><siteMapNodeurl="Page11.aspx"title="Page11"description="Page11"/><siteMapNodeurl="Page12.aspx"title="Page12"description="Page12"/><siteMapNodeurl="Page13.aspx"title="Page13"description="Page13"/></siteMapNode></siteMapNode></siteMap>
Also I have placed a sitemappath control on my aspx page-
<asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
Please guide me where I am doing wrong. I read few articles and it says that this much of step is enough for adding breadcrumbs on every pages of a web site.
Please Guide me where I am doing Wrong?
AshOmi

asp.net

$
0
0
how Can I Use My Web User Control When I Click On Radio Button Using Java Script? Code Is Given Below Please Help Me

See more: ASP.NETJavascript
Hi i have a web user control LoginControl.ascx, and a userinfo page on which I have two radio button "yes" and "no" for choice for complete your profile now or later
if user select "yes" then a panel be visible for fill the detail and all other things be unvisible using java script when user click on submit ,all information saved in database and this panel does hide and panel of logincontrol(in this panel my logincontrol.ascx is exist) is visible when user log in then it is working but when user click on " no " radio button then use control not working means it's "login" button or "new user" button is not firing any event.

please help me .. i am sharing my code
 
This is source of web user controlgt;

 
<asp:Panel ID= "panellogin" runat="server" Width="324px">
Please  Login here 
Email Address<asp:TextBox ID= "txtlogin" runat="server">
Password<asp:TextBox ID= "txtpswrd" runat="server">
 <asp:Button ID="btnlogin"
runat="server" Text="Login" onclick="btnlogin_Click"/>
<asp:Button ID="btnnewuser" runat="server" onclick="btnnewuser_Click"
Text="New User" />


this is code behind of LoginControl(user control)

 
Collapse | Copy Code
protected void btnlogin_Click(object sender, EventArgs e)
{
dbManager.ConnectionString = ConfigurationSettings.AppSettings["Connectionstring"].ToString();
dbManager.Open();
dbManager.CreateParameters(2);
dbManager.AddParameters(0, "@email", txtlogin.Text);
dbManager.AddParameters(1, "@pass", txtpswrd.Text);
DataSet ds= dbManager.ExecuteDataSet(CommandType.Text, "select * from UserAccount where Email=@email and Password=@pass");
if (ds.Tables[0].Rows.Count == 0)
{
Response.Write("please enter valid email or passwor");
}
else
{
Response.Redirect("Trainer/TProfile.aspx");
}

}
protected void btnnewuser_Click(object sender, EventArgs e)
{
Response.Redirect("Register.aspx");
}
}
 

Now this code is for userinfo.aspx page

<%@ Page Title="" Language="C#" MasterPageFile="~/Completeprofile.master" AutoEventWireup="true" CodeFile="userinfo.aspx.cs" Inherits="userinfo" %>
<%@ Register TagPrefix="uc" TagName="Spinner"
Src="~/LoginControl.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" language="javascript">
function showhidepanel(rad) {
if (document.getElementById(rad.id + '_0').checked) {
document.getElementById('ContentPlaceHolder1_profilepanel').style.display = 'inline';
document.getElementById('ContentPlaceHolder1_panellogin').style.display = 'none'
}
if (document.getElementById(rad.id + '_1').checked) {
document.getElementById('rowprofile').style.display = 'none';
document.getElementById('ContentPlaceHolder1_profilepanel').style.display = 'none';
document.getElementById('ContentPlaceHolder1_panellogin').style.display = 'inline';
}

}
function showlogin() {
// document.getElementById('ContentPlaceHolder1_profilepanel').style.display = 'none'

document.getElementById('tbll').style.display = 'none';
document.getElementById('ContentPlaceHolder1_panellogin').style.display = 'inline';
 
}
</script>
 

family
 

 

 

 

 


 
Dear
<asp:Label ID="username" runat="server" Text="Label">
Please Complete your profile<asp:Label ID="lblmsg" runat="server" ForeColor="Red"
Text="Label" Visible="False">
Would you like to complete your profile now ? <asp:RadioButtonList ID="rbl1" RepeatDirection="Horizontal" runat="server" onclick="showhidepanel(this);" >
<asp:ListItem Value="Yes">Yes
<asp:ListItem Value="No">No
 
<asp:Panel ID ="profilepanel" runat="server" style="display:none">
 

style="border-style: outset; width: 100%">
 
Education <asp:TextBox ID="txteducatn" runat="server"
ontextchanged="txteducatn_TextChanged">
<asp:RequiredFieldValidator ID="reqedu" runat="server"
ControlToValidate="txteducatn" ErrorMessage="Education req" Font-Size="Smaller"
ForeColor="Red">
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1"
runat="server" TargetControlID="reqedu">
 

Certification <asp:TextBox ID="txtcertification" runat="server">
 
Experience <asp:TextBox ID="txtexprnc" runat="server">
 
Second Email <asp:TextBox ID="txtscndemail" runat="server">
 
Other Contact <asp:TextBox ID="txtcntact" runat="server">
 
DOB
 
<asp:TextBox ID="TXTDOB" runat="server">
<ajaxToolkit:CalendarExtender ID="clndrdob" runat="server" TargetControlID="TXTDOB">
<asp:RequiredFieldValidator ID="dobreq" runat="server"
ErrorMessage="DOB Req" ControlToValidate="TXTDOB"
Font-Size="Smaller" ForeColor="Red">
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" TargetControlID="dobreq">
 

<%-- <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtdate" PopupButtonID="image1" >
 
<img id="image1" runat="server" src="~/images/calendar.png" alt="" />--%>
Upload your profile pic <asp:FileUpload ID="prflupload" runat="server" />
<asp:Button ID="submit" Text="Submit" onclick="submit_Click" runat="server"/>
 

<asp:Panel ID="panel2" runat="server" style="display:none">
 

 
<asp:Panel ID= "panellogin" runat="server" >
<uc:Spinner id="Spinner1"
runat="server"
MinValue="1"
MaxValue="10" />
 

 

 


 

 
Please help me Thanks to all of you in ad

asp.net application for internal company telephone extension

$
0
0
is it possible to create a small application (asp.net) for the managers in the company to search for desired extension and call the extension directly from the application using his/her extension .
 

thanks in advance

Explain the exceptions in ASP.Net webforms

$
0
0
could you share the information about exceptions.
 
Exp: in one class i am using more then on exception and also null bull exception.

Read File and save in datatable

$
0
0
I am reading a file into datatable.
In file I have 3 column but in my datatable 4.
Column 4 in datatable needs to be populated at run time before or after full file is loaded into dt.
how do I do this?
Dim lines = File.ReadAllLines(FileName)
For Each line As String In lines
dt.Rows.Add(line.Split("|"))
Next

ASP.NET MVC4 MembershipProvider

$
0
0
hello, I'm basically following steps as described here[^], building a new MVC4 app with my custom MembershipProvider extending from "WebMatrix.WebData.SimpleMembershipProvider".
 
Question is, what if I don't want to persists my users in database at all? With SimpleMembershipProvider, you must call "WebSecurity.InitializeDatabaseConnection" from "InitializeSimpleMembershipAttribute \ LazyInitializer.EnsureInitialized" at least once during startup.
 
Thank you!

Encryption (Clent Side using JS) and Decryption (Server Side)

$
0
0
Dear All,
 
I have scenario to encrypt the Password in client side and decrypt it in server side (C# code), this is required for a Online website.
 
Can any one help me on this task.
 
- Febin R
 
-

access data from another table

$
0
0
i have Person table and i want access PersonId in complain table.
DataTable dt = PersonBLL.Select(new Person() { ??????? });
I create select code in BLL.
But what write in place of ????? I don't know.
plz help me...

MVC4 Razor @model - what's equivalent in ASPX view engine?

$
0
0
hi MVC4 Razor <a href="/Members/model">@model</a> - what's equivalent in ASPX view engine?
 
Here's how it's done with Razor - how to do the same in ASPX?
 
<a href="/Members/model">@model</a> IEnumerable<XYZ.Product>
 
@{
      ViewBag.Title = "Downloads";
      Layout = "~/Views/Shared/_Layout.cshtml";
}
<div>                                                                                                     
<table>
      <tr>
            <th>Name</th>
            <th>Description</th>
            <th></th>
      </tr>
     
      <a href="/Members/foreach">@foreach</a> (var Package in Model) {
      <tr>
            <td>
                  <a href="/Members/html">@Html</a>.DisplayFor(modelItem => Package.Name)
            </td>
            <td>
                  <a href="/Members/html">@Html</a>.DisplayFor(modelItem => Package.Description)
            </td>
            <td>
                  <a href="/Members/html">@Html</a>.ActionLink("Download", "ProductDownload", Package)
            </td>
      </tr>
      }
</table>

gateway

$
0
0
could u till me a free gateway for sending sms from different free sms providers please could any body tell me

Blog

$
0
0
How do i add a blog on my ASP.NET webpage

Customize the WebApi2 Authentication and Authorization + Oauth

$
0
0
I want to Customize WebApi2 Oauth security provider. I want to use my own data base and own DbContext. Please help me how to do?
 
I am using asp.net 2013.
 

 
Thanks

Set label for gridview while export to excel

$
0
0
Below is my aspx
 
<%@ Page Title="Report" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Code" EnableEventValidation="false" %>
 
<asp:content id="Content1" contentplaceholderid="head" runat="Server">
 
<asp:label id="Label1" runat="server" font-bold="True" font-size="Medium" font-underline="True"
forecolor="#000066" text="Reports">


 

<asp:gridview id="GridView1" runat="server" showfooter="true" onrowdatabound="GridView1_RowDataBound"
width="985px" allowsorting="false" gridlines="None">

<headerstyle font-bold="True" font-names="Times New Roman" font-size="Medium" font-underline="True"
forecolor="Blue" />






 

<asp:gridview id="GridView2" runat="server" showfooter="true" allowsorting="false"
onrowdatabound="GridView1_RowDataBound" width="985px" gridlines="None" style="margin-left: -315px">

<headerstyle font-bold="True" font-names="Times New Roman" font-size="Medium" font-underline="True"
forecolor="Blue" />





I am using the below code to export two gridviews to excel.
 
protected void ExporttoExcel(object sender, EventArgs e)
{
try
{
GridView[] gvList = null;
gvList = new GridView[] { GridView1, GridView2 };
ExportAv("Report.xls", gvList);
}
catch (Exception ex)
{
 
}
}
 
public static void ExportAv(string fileName, GridView[] gvs)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
 
foreach (GridView gv in gvs)
{
gv.AllowPaging = false;
 
// Create a form to contain the grid
Table table = new Table();
 
table.GridLines = gv.GridLines;
// add the header row to the table
if (!(gv.Caption == null))
{
TableCell cell = new TableCell();
cell.Text = gv.Caption;
cell.ColumnSpan = 10;
TableRow tr = new TableRow();
tr.Controls.Add(cell);
table.Rows.Add(tr);
}
 
if (!(gv.HeaderRow == null))
{
table.Rows.Add(gv.HeaderRow);
}
// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
table.Rows.Add(row);
}
// add the footer row to the table
if (!(gv.FooterRow == null))
{
table.Rows.Add(gv.FooterRow);
}
// render the table into the htmlwriter
table.RenderControl(htw);
}
// render the htmlwriter into the response
 
string headerTable = @"

Report

" + DateTime.Now.ToString("d") + "

";
HttpContext.Current.Response.Write(headerTable);
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
}
}
This code gives a general title called Report and date at the top of the report. Now how can I possibly give a title name for gridviews when exporting the grid to excel?

asp.net site taking all the CPU after a while

$
0
0
I have a big issue with the asp.net site I did. It's hosted on a server station, with IIS 7, and many clients (around 10) are accessing it. Around twice a week, the site is unacessible. When checking on the server, the CPU is at 100%. Resetting he application pool solves it.
 
The page has a auto-refresh function to update the products status (with color depending on the status). It fetches informations from other internal sites and Perforce. The refresh is done by a timer and set to 30 seconds.
 
<pre lang="HTML"><pre><asp:Timer ID="tmrTimer" OnTick="tmrTimer_Tick" Interval="300000" runat="server"></asp:Timer>
 
When the client select a product, I fill the page with the corresponding information. There is a table with the option runat="server" that I clear and fill with lines containing the information.
 
I place logs to check what was taking so long, but the total init time of the page is always under 1 second (there is information caching), even if the user has to wait more time than that to see the information.
 
At first, I thought the refresh was taking too long and that it was launching a new refresh before finishing the first one, so I increased the refresh time to 30 seconds, but it does not seem to be the case (unless the user clicks on another product before the product information finished displaying.
 
Here is my page initialization logic. It might not be the best way (since I don't have much experience with web programming), but it works. I only need to fix the CPU usage issue that forces us to reboot the server once in a while.
 
I think it might be caused by some threads working that were not terminated for some reason. I have to make a series of tests next week, but wanted to know in which direction to look or if someone had an idea.
 
protectedvoid Page_Load(object sender, EventArgs e)
    {
        //Menus are updated here instead of in the page_init because the items.clear
//did not seem to work when called from page_init
if (IsPostBack)
        {
            return;
        }
        var d = DateTime.Now;
        UpdateMenus();
        Log.Info("Update menus : " + DateTime.Now.Subtract(d).Milliseconds + " ms");
    }
 
    protectedvoid Page_Init(object sender, EventArgs e)
    {
        //Variables for logging purposes
var source = "";
        var t = DateTime.Now;
        var d = DateTime.Now;
 
        //Fetch the product Id
        SessionSettings.SelectedProductId = Request.QueryString["ProductId"];
 
        if (!IsPostBack)
        {
            CreateMenusDictionnary();
            SessionSettings.TurnAllDisplayOff();
            Session[CURRENT_BRANCH_KEY] = null;
            Session[CURRENT_SOFTWARE_KEY] = null;
            DisplaySelectedProductInfo();
            source = "(startup)";
            if (!string.IsNullOrEmpty(SessionSettings.SelectedProductId))
            {
                source = "(" + SessionSettings.SelectedProductId+ ")";
            }
        }
 
        if (Session["updateProducts"] != null&& (bool)Session["updateProducts"])
        {
            d = DateTime.Now;
            UpdateProducts();
            Log.Info("Update products status : " + DateTime.Now.Subtract(d).Milliseconds + " ms");
        }
 
        var ctrl = WebApplicationHelper.GetPostBackControl(this);
 
        //Prevents update by timer when refreshing something else
if (!(ctrl is Timer))
        {
            tmrTimer.Enabled = false;
        }
 
        if(ctrl != null)
        {
            CreateMenusDictionnary();
            if (ctrl is Button)
            {
                var p = FindProduct(SessionSettings.SelectedProductId);
 
                if (Session[SessionSettings.TABLE_MANAGER_KEY] == null)
                {
                    Session[SessionSettings.TABLE_MANAGER_KEY] = new ProductsInfoTableManager(productInfoTable);
                }
                var manager = (ProductsInfoTableManager)Session[SessionSettings.TABLE_MANAGER_KEY];
                manager.SetProductsInfoTable(productInfoTable);
                source = "(Expand button)";
                switch (ctrl.ID)
                {
                    case"diffButton":
                        SessionSettings.ShowDifferences = !SessionSettings.ShowDifferences;
                        manager.RefreshDiffFixes(p);
                        break;
                    case"fixesButton":
                        SessionSettings.ShowFixes = !SessionSettings.ShowFixes;
                        manager.RefreshDiffFixes(p);
                        break;
                    case"manualTestsDisplayChangelistsButton":
                        source = "(manualTestsDisplayChange)";
                        SessionSettings.ShowManualTestsByType = ExcelTestsReader.AggregateType.Changelist;
                        SessionSettings.TurnOffTestsDisplay();
                        manager.RefreshManualTests(p);
                        break;
                    case"manualTestsDisplayTestNamesButton":
                        source = "(manualTestsDisplayChange)";
                        SessionSettings.ShowManualTestsByType = ExcelTestsReader.AggregateType.Test;
                        SessionSettings.TurnOffTestsDisplay();
                        manager.RefreshManualTests(p);
                        break;
                    default:
                        if (ctrl.ID.StartsWith("errors_"))
                        {
                            SessionSettings.ToggleShowErrors(ctrl.ID);
                            manager.RefreshWorkflowErrors(p);
                        }
                        elseif (ctrl.ID.StartsWith("manualTestsExpand_"))
                        {
                            SessionSettings.ToggleShowManualTest(ctrl.ID);
                            manager.RefreshManualTests(p);
                        }
                        else
                        {
                            DisplaySelectedProductInfo();
                        }
                        break;
                }
            }
 
            if (ctrl is Timer)
            {
                source = "(timer)";
                d = DateTime.Now;
                UpdateProducts();
                Log.Info("Update products status (timer) :" + DateTime.Now.Subtract(d).Milliseconds + " ms");
                DisplaySelectedProductInfo();
            }
        }
        Log.Info("Total init time " + source + " : " + DateTime.Now.Subtract(t).Milliseconds + " ms");
 
        //Reactivates timer
if (!tmrTimer.Enabled)
        {
            tmrTimer.Enabled = true;
        }
    }
	
	
    //Refreshes the informations periodically for real-time monitoring
protectedvoid tmrTimer_Tick(object sender, EventArgs e)
    {
	
    }	

Why it is so hard to play with html in visual studio

$
0
0
Hi guys,
First of all thanks, you guys are super helpful. I always wanted to become a coder, now i see this dream coming to reality with help of you guys.
 
Now, i am learning asp.net with the help of local teacher. We are going to create a new website.
 
Now, we "open a new website", created a master page.
 
However, editing this template in visual studio is nightmare.
 
You delete something and something else gets spaced out. However, when you see everything in webbrowser, everything comes out allright.
 
Is there a better way to do this? I am using 2010 VS.
 
1) Should i use dreamweaver first. design everything first and than, move to visual studio?
 
How you guys do it?
 
Thanks

Using CrystalReport Implement Print

$
0
0
Hey,everyone
i want to use CrystalReport Implement Print,but it must export pdf ,i feel it is trouble,Have other methods deal it? example using PrintControl,lodop and so on, Language(asp.net (C#)) Web Print. :(

Urgent help how creating forums with ASP.NET using C#

$
0
0
HI guys I am in 4th stage software engineering and I'm working on my project currently I am facing a problem I finished my website design and security and I want to create forums with using ASP.net C# for students to ask questions find answers and share ideas is there easy way to create forums I am using visual studio with Devexpress tools

how to add datepicker in gridview boundfield column

$
0
0
how to add datepicker in gridview boundfield column..rply me on my emailid rohraheenu@gmail.com

Single Login page for multiple applications.

$
0
0
Hi,
 
I was developed 4 applications with different login pages by using "asp.net web site administration tool 2010" and i deployed in server(IIS).
Now the requirement is like i need to create new application with common login page and home page for 4 applications. By using that common home page i need to access 4 aplications which i deployed in iis.
 
Thank you.

asp.net related question

$
0
0
how i insert google map in my asp.net project with c# project
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>