|
I am using OpenXML to generate Excel doc how to I apply styles for specific cell?
Dim CellStyleFormats As New CellStyleFormats
With CellStyleFormats
.?????
End With
mergeCell.Append(CellStyleFormats)
mergeCells.Append(mergeCell)
|
|
|
|
|
Hi,
I have some aspx pages, as we are adding some new applications which are going to use some of the same pages we want to make those common pages as user controls.
I started making the aspx pages into User controls I changed the name of the files to ascx, ascx.cs, removed page attribute and put the control attribute, removed html, body and form tags from aspx file, in code behind I made change to inherit from UserControl class. Everything looks good upto this.
But those previous aspx pages were accessing some user controls, now those controls are displaying error message. Like at uc1:htmlhead and uc1:formheader it is displaying error message as "Unrecognized tag prefix or device filter uc1".
Below are the register and control directives for the user control. For the current User Control I have taken Control directive and for other ones I have taken Register directive. Am I missing any where. Please help me or suggest me or give me a link, any type of help is very helpful. Thanks in advance.
<%@ Register TagPrefix="uc1" TagName="HtmlHead" Src="../Includes/HtmlHead.ascx" %>
<%@ Page Language="c#" CodeBehind="ChangePass.ascx.cs" AutoEventWireup="false" Inherits="DIS.CnpWeb.Core.ChangePass" %>
<%@ Register TagPrefix="uc1" TagName="FormFooter" Src="../Includes/FormFooter.ascx" %>
<%@ Register TagPrefix="uc1" TagName="FormHeader" Src="../Includes/FormHeader.ascx" %>
<uc1:htmlhead id="HtmlHead1" runat="server"></uc1:htmlhead>
<uc1:formheader id="FormHeader1" runat="server"></uc1:formheader>
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Can you provide the top section of you user control?
|
|
|
|
|
Here is the whole form
<%@ Control Language="c#" CodeBehind="~/Rollover.ascx.cs" ClassName="Rollover" AutoEventWireup="false" Inherits="DIS.CnpWeb.Core.Rollover" %>
<%----%>
<asp:Table ID="tblSection0" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell ID="tdpSection0" Text="Rollover"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="3">
<asp:Image runat="server" ID="imgSection0"></asp:Image>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="tblError0" runat="server" Width="100%" CellSpacing="1" GridLines="Both"></asp:Table>
<p></p>
<asp:Table ID="tblError1" runat="server" Width="100%" CellSpacing="1" GridLines="Both"></asp:Table>
<p></p>
<asp:Table ID="tblSection1" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell ID="tdnSourceYear" Text="(1)" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpSourceYear" Text="Source Year:" runat="server"></asp:TableCell>
<asp:TableCell ID="tddSourceYear" Width="20%" Text="200X" HorizontalAlign="Left" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpDataSource" Width="20%" Text="Data Source:" runat="server"></asp:TableCell>
<asp:TableCell ID="tddDataSource" Width="30%" Text="Some Server" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdnTargetYear" Text="(2)" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpTargetYear" Text="Target Year:"></asp:TableCell>
<asp:TableCell ID="tddTargetYear" Text="200Y" HorizontalAlign="Left" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpCatalog" Text="Database Name:" runat="server"></asp:TableCell>
<asp:TableCell ID="tddCatalog" Text="MyDatabase" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdnProgSelect" Text="(3)" runat="server"></asp:TableCell>
<asp:TableCell ID="tdpProgSelect" Text="Programs to Process:"></asp:TableCell>
<asp:TableCell ID="tddProgSelect" ColumnSpan="1" runat="server">
<asp:DropDownList ID="ddlProgSelect" runat="server"></asp:DropDownList>
</asp:TableCell>
<asp:TableCell ID="tddSelectPgm" runat="server" ColumnSpan="2">
<asp:Button ID="btnSelectPgm" runat="server" Text="Select Program"></asp:Button>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tdrNslp" HorizontalAlign="Left" runat="server">
<asp:TableCell ID="tdnNslp" ColumnSpan="2" runat="server"> </asp:TableCell>
<asp:TableCell ID="tddNslp" ColumnSpan="3" runat="server">
<asp:CheckBox ID="chkNslp" Text="NSLP" runat="server"></asp:CheckBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tdrSfsp" HorizontalAlign="Left" runat="server">
<asp:TableCell ID="tdnSfsp" ColumnSpan="2" runat="server"> </asp:TableCell>
<asp:TableCell ID="tddSfsp" ColumnSpan="3" runat="server">
<asp:CheckBox ID="chkSfsp" Text="SFSP" runat="server"></asp:CheckBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tdrCI" HorizontalAlign="Left" runat="server">
<asp:TableCell ID="tdnCI" ColumnSpan="2" runat="server"> </asp:TableCell>
<asp:TableCell ID="tddCI" ColumnSpan="3" runat="server">
<asp:CheckBox ID="chkCI" Text="CI" runat="server"></asp:CheckBox>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<p></p>
<asp:Table ID="tblStats" runat="server" Width="100%" CellSpacing="1" GridLines="None">
<asp:TableRow>
<asp:TableCell ID="tdpStats" Text="Rollover Status" ColumnSpan="6" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="6">
<asp:Image ID="imgStats" runat="server"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow CssClass="ColHeading">
<asp:TableCell ID="tdpTblNme" runat="server" Text="Table Name" Width="25%"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot" runat="server" Text="Source Total" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct" runat="server" Text="Source Inactive" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna" runat="server" Text="Source Active" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot" runat="server" Text="Target Active" Width="15%"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt" runat="server" Text="Batch Results" Width="15%"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat1" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme1" runat="server" Text="Program Year"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot1" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt1" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2" runat="server" Text="Sponsor Application"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2a" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2a" runat="server" Text=" Sponsor App A"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2a" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2b" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2b" runat="server" Text=" Sponsor App B"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2b" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2c" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2c" runat="server" Text=" Sponsor App C"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2c" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat2d" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme2d" runat="server" Text=" Sponsor App D"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt2d" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat3" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme3" runat="server" Text="Sponsor Location"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot3" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt3" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat4" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme4" runat="server" Text="Product Cost"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot4" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt4" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat5" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme5" runat="server" Text="Program Enrollment"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot5" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt5" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat6" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme6" runat="server" Text="Entity Xref"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot6" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt6" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat7" runat="server" CssClass="OddRow">
<asp:TableCell ID="tdpTblNme7" runat="server" Text="County Region Xref"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot7" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt7" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="tbrStat8" runat="server" CssClass="EvenRow">
<asp:TableCell ID="tdpTblNme8" runat="server" Text="Warehouse Region Xref"></asp:TableCell>
<asp:TableCell ID="tdpSrcTot8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcIna8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpSrcAct8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpTrgTot8" runat="server" HorizontalAlign="Right"></asp:TableCell>
<asp:TableCell ID="tdpRollCnt8" runat="server" HorizontalAlign="Right"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<p></p>
<asp:Table ID="tblSummary" runat="server" Width="100%" CellSpacing="1" GridLines="None">
<asp:TableRow>
<asp:TableCell ID="tdpSummary" Text="Rollover Summary" ColumnSpan="2" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="2">
<asp:Image ID="imgSummary" runat="server"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchNbr" runat="server" Text="Batch Number:" Width="20%"></asp:TableCell>
<asp:TableCell ID="tddBatchNbr" runat="server" Text="1004"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchCount" runat="server" Text="Records Added:"></asp:TableCell>
<asp:TableCell ID="tddBatchCount" runat="server" Text="12,452"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchStart" runat="server" Text="Start Time:"></asp:TableCell>
<asp:TableCell ID="tddBatchStart" runat="server" Text="10:05:00"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchEnd" runat="server" Text="End Time:"></asp:TableCell>
<asp:TableCell ID="tddBatchEnd" runat="server" Text="10:07:45"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchTime" runat="server" Text="Total Time:"></asp:TableCell>
<asp:TableCell ID="tddBatchTime" runat="server" Text="00:02:45"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="tdpBatchDte" runat="server" Text="End Date:"></asp:TableCell>
<asp:TableCell ID="tddBatchDte" runat="server" Text=""></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="tblViewLog" runat="server" Width="100%" CellSpacing="1" GridLines="None" BorderWidth="2"
BorderStyle="Solid">
<asp:TableRow>
<asp:TableCell ID="tdpViewLog" Text="Rollover Log" ColumnSpan="2" runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="2">
<asp:Image ID="imgViewLog" runat="server"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ID="txtViewLogData" runat="server" Text="Log Data Here"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="tblButton" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell>
<asp:Image runat="server" ID="imgBottom"></asp:Image>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center">
<asp:Button runat="server" ID="btnSubmit" Text="Run Rollover"></asp:Button>
<asp:Button runat="server" ID="btnCancel" Text="Cancel"></asp:Button>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<%----%>
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Looking at the ChangePass.ascx, it is a control so the following tag is incorrect:
<%@ Page Language="c#" CodeBehind="ChangePass.ascx.cs" AutoEventWireup="false" Inherits="DIS.CnpWeb.Core.ChangePass" %>
it should be:
<%@ Control Language="c#" AutoEventWireup="false" CodeFile="ChangePass.ascx.cs"
Inherits="DIS.CnpWeb.Core.ChangePass" %>
don't know if this will fix your error but this can be leading up to the issue.
|
|
|
|
|
Hey Guys
i have to create a webpage that has a button and gridview, once the button is pressed it triggers the click button method which searches my computer for files in a specific folder once files are found it displays it in the grid view .
which i have managed to do my problem is im expected to then give the ability that if the user clicks on the file name(which is a hyperlink) in the grid view that it opens on a new page and that the file is embed in that page ready for viewing??
i have tried all i can think off.
ps the files not in a db they in a folder on my pc later will be on a sever in a folder
hope some on can help me
here is what i have so far
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="119px" >
<Columns>
<asp:TemplateField HeaderText="FileName">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Dir","~/Dir={0}")%>' Text='<%# Eval("File") %>' PostBackUrl="/WebForms4.aspx"> </asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="size" HeaderText="size" />
<asp:TemplateField HeaderText="diretory">
<ItemTemplate>
<asp:Button ID="Button2" runat="server" CommandArgument='<%# Eval("Dir","~/WebForms4.aspx/files?Dir={0}") %>' Text='<%# Eval("Dir") %>' PostBackUrl="~/WebForms4.aspx?Dir={0}" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and C# code
protected void Button1_Click(object sender, EventArgs e)
{
DataTable Dt = new DataTable();
Dt.Columns.Add("File", typeof(string));
Dt.Columns.Add("Size", typeof(string));
Dt.Columns.Add("Dir", typeof(string));
foreach (string filename in Directory.GetFiles(@"C:\files"))
{
FileInfo fileinfo = new FileInfo(filename);
Dt.Rows.Add(fileinfo.Name, fileinfo.Length +"KB", fileinfo.FullName);
}
GridView1.DataSource = Dt;
GridView1.DataBind();
}
Thanks in advanced
|
|
|
|
|
please explain me how to insert images to word document created through .net
|
|
|
|
|
|
Hi, I have written a control that inherits from DataBoundControl
[ToolboxData("<{0}:MyClass runat=server></{0}:MyClass>")]
[Designer(typeof(MyClassDesigner))]
[ToolboxItem(true)]
public class MyClass: DataBoundControl
Problem is, when I try to drag it from the toolbox to the page, the mouse cursor changes to an icon that represents it's not allowed(circle with diagonal line through it). How do I make my control support that? The control works just fine if I manually type it in the page.
What am I forgetting? Any ideas?
|
|
|
|
|
Dear all,
When I call 'api/values', it only allows me login as 'full' user details, but if a login as 'trial' user login details, it throws a 401 error. I would like to ask, if I am missing something in the queries in the user class below or the basicAuthn class:
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
AuthenticationHeaderValue authValue = request.Headers.Authorization;
if (authValue == null || authValue.Scheme != BasicAuthResponseHeaderValue)
{
return Unauthorized(request);
}
string[] credentials = Encoding.ASCII.GetString(Convert.FromBase64String(authValue.Parameter)).Split(new[] { ':' });
if (credentials.Length != 2 || string.IsNullOrEmpty(credentials[0]) || string.IsNullOrEmpty(credentials[1]))
{
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(string.Format("access denied")),
};
}
ClaimRole user = repository.trial(credentials[0], credentials[1]);
ClaimRole user2 = repository.unlim(credentials[0], credentials[1]);
if (user == null || user2 == null)
{
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(string.Format("access denied")),
};
}
else
{
IPrincipal principal = new GenericPrincipal(new GenericIdentity(user.Username, BasicAuthResponseHeaderValue), new string[] { user.role });
Thread.CurrentPrincipal = principal;
HttpContext.Current.User = principal;
}
return base.SendAsync(request, cancellationToken);
}
User Class
public ClaimRole trial(string username, string password)
{
var query = (from s in db.subs
join u in db.user on s.sUID equals u.uID
where s.sExpiryDate >= DateTime.Now &&
u.uUsername == username &&
u.uPassword == password
select u).FirstOrDefault();
if (query != null)
{
return new ClaimRole { Username = query.uUsername, Password = query.uPassword, role = "Trial" };
}
else
{
return null;
}
}
public ClaimRole full(string username, string password)
{
var query = (from s in db.subs
join u in db.user on s.sUID equals u.uID
where s.sPID.Value == 163 &&
u.uUsername == username &&
u.uPassword == password
select u).FirstOrDefault();
if (query != null)
{
return new ClaimRole { Username = query.uUsername, Password = query.uPassword, role = "full" };
}
else
{
return null;
}
}
Please advise
many thanks
|
|
|
|
|
I guess the problem is here:
ClaimRole user = repository.trial(credentials[0], credentials[1]);
ClaimRole user2 = repository.unlim(credentials[0], credentials[1]);
if (user == null || user2 == null)
If the user does not have BOTH the trial and unlim priviledges, you send the Access Denied message.
Use && isntead of || .
|
|
|
|
|
Thank you so much for your response and help. I am sorry to inform, that i have tried using the '&&' operator but I am still getting the same 401 error, when logging in using full query user details.
i would like to ask, if their is certain parameter and method, i should be looking into while debugging the code.
I really appreciated your help. please advise.
Many thanks.
|
|
|
|
|
then test those two repository.trail / repository.unlim functions. At least one of them has a bug.
|
|
|
|
|
Thank you for your feedback. i am stuck on little status code issue, regarding this long problem. When I debug the full and trial repository, while login as 'trail' user, 'resp' variable below is highlighted as red with a 404 status code, but on the fiddler testing environment, it displays the url as 401 unauthorized issue.
ClaimRole user = repository.trial(credentials[0], credentials[1]);
ClaimRole user2 = repository.full(credentials[0], credentials[1]);
if (user == null || user2 == null)
{
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(string.Format("access denied")),
};
}
else
{
<br />
resp -- {StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
Hence I am little unclear, which error to look into. if you get time, could you please advice on any material i should look into or concentrate on.
Many thanks for your time and help.
|
|
|
|
|
As of now,Popup in a page asks for password and onclick jquery ajax method calls webmethod, which returns the actual password of the user for validation.
But if a press F12,the password gets viewed as response .
Note:- After buttonclick, page needs to redirect to the same page.
|
|
|
|
|
Never send a password back to the client. The program should send the user's input to the server side for validation. Not the other way round.
|
|
|
|
|
Apart from the fact that you shouldn't be sending the user's password to an unauthenticated client, you shouldn't be able to send the user's password, ever.
Passwords should NEVER be stored in plain text.
You should be storing a salted hash of the password. When you need to verify the entered password, you apply the same salting and hashing algorithm to the entered password, and compare the result to the stored salted hash of the real password.
See Salted Password Hashing - Doing it Right[^] for more information.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
I am trying to write repeater values in to Excel file, it is writing something but it not writing clearly. Can anybody please help where am I doing mistake. Another problem is repeater control has text boxes and td values. Initially I couldn't write into excel because of text boxes then I did this work around but didn't give me the solution I want.
Here is my code:
protected void ExportToExcel(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.AddHeader("Content-Disposition", "attachment;filename=" + ConfigurationManager.AppSettings["ExcelFilePath"].ToString() +
ddlProductId.Text + "_" + ddlProcessor.Text + ".xls");
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
HtmlForm frm = new HtmlForm();
this.Page.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(this.rptMonthlyReport);
frm.RenderControl(oHtmlTextWriter);
rptMonthlyReport.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{ }
public override bool EnableEventValidation
{
get { return false; }
set { }
}
Then I have out put displayed as below. Please help me in this regard. Any help link or code snippet or a suggestion would help me a bit. Thanks in advance.
input type+AD0AIg-hidden+ACI- name+AD0AIgBfAF8-VIEWSTATE+ACI- id+AD0AIgBfAF8-VIEWSTATE+ACI- value+AD0AIgAi- /+AD4- +ADw-/div+AD4- +ADw-header+AD4- +ADw-span id+AD0AIg-rptMonthlyReport+AF8-Label3+ACI- class+AD0AIg-FormHead2+ACIAPg-Monthly Performance Report Tracking+ADw-/span+AD4- +ADw-/header+AD4- +ADw-table width+AD0AIg-100+ACUAIg- id+AD0AIg-tblMonthlyReport+ACI- cellspacing+AD0AIg-2+ACI- border+AD0AIg-1+ACIAPg- +ADw-tr+AD4- +ADw-td class+AD0AIg-ColHeading+ACIAPg-Recipient Agency+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-false+ACI- style+AD0AIg-width: 4+ACUAOwAiAD4- +ADw-span id+AD0AIg-rptMonthlyReport+AF8-lblCarryOverQty+ACI- class+AD0AIg-ColHeading+ACI- style+AD0AIg-display:inline-block+ADs-width:99+ACUAOwAiAD4-SY 2012-13+ADw-br /+AD4- Carry +ADw-br /+AD4-Over Pounds+ADw-/span+AD4APA-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-false+ACI- style+AD0AIg-width: 4+ACUAOwAiAD4- +ADw-span id+AD0AIg-rptMonthlyReport+AF8-lblDivertedQty+ACI- class+AD0AIg-ColHeading+ACI- style+AD0AIg-display:inline-block+ADs-width:99+ACUAOwAiAD4-Pounds +ADw-br /+AD4-Diverted for+ADw-br /+AD4-SY 2013-14+ADw-/span+AD4APA-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Jul+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Aug+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Sep+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Oct+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Nov+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Dec+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Jan+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Feb+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Mar+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Apr+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-May+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-true+ACI- style+AD0AIg-width: 4+ACUAIgA+-Jun+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- style+AD0AIg-width: 6+ACUAOw- flex-wrap: wrap+ADsAIgA+-Qty Trans Frm Sponr To State+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- style+AD0AIg-width: 6+ACUAOw- flex-wrap: wrap+ADsAIgA+-Qty Trans Frm State To Sponr+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- style+AD0AIg-width: 6+ACUAOw- flex-wrap: wrap+ADsAIgA+-Qty Trans Frm Sponr To Sponr+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- nowrap+AD0AIg-false+ACI- style+AD0AIg-width: 4+ACUAIgA+-Total+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- style+AD0AIg-width: 4+ACUAOw- flex-wrap: wrap+ADsAIgA+-Prior Yr Left Over+ADw-/td+AD4- +ADw-td class+AD0AIg-ColHeading+ACI- style+AD0AIg-width: 2+ACUAOw- flex-wrap: wrap+ADsAIgA+-Ext Ind+ADw-/td+AD4- +ADw-/tr+AD4- +ADw-tr class+AD0AIg-OddRow+ACI- width+AD0AIg-95+ACUAIgA+- +ADw-td align+AD0AIg-left+ACI- style+AD0AIg-border: none+ADsAIgA+- +ADw-input name+AD0AIg-rptMonthlyReport+ACQ-ctl16+ACQ-Hidden1+ACI- type+AD0AIg-hidden+ACI- id+AD0AIg-rptMonthlyReport+AF8-Hidden1+AF8-0+ACI- value+AD0AIg-10001+ACI- /+AD4- Baker SD 5J +ADw-/td+AD4- +ADw-td id+AD0AIg-rptMonthlyReport+AF8-tdCarryOverQty+AF8-0+ACI- align+AD0AIg-right+ACI- style+AD0AIg-width: 4+ACUAIgA+- +ADw-input name+AD0AIg-rptMonthlyReport+ACQ-ctl16+ACQ-txtCarryOverQty+ACI- type+AD0AIg-text+ACI- value+AD0AIg-0.00+ACI- id+AD0AIg-
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Try this
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=namefile.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
rep.RenderControl(htmlWrite);
Response.Write("<table>");
Response.Write(stringWrite.ToString());
Response.Write("</table>");
Response.End();
|
|
|
|
|
Hi,
Thank you for your help, it is working fine but the alignments are not that good. Like a column is taking lot of space but the other is not.
And I think it is taking Text boxes as it is in the excel file, is there any way to make everything as normal text and write those values in to excel file as just normal text.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Do you have text-boxes in repeater? while exporting data to excel i think there should textbox instead of that labels or Literals should be there,
|
|
|
|
|
Yes I do have text box, they are editable text boxes. This client made me to create almost an online excel sheet man . Sorry I was kidding. But yes it has text boxes. And I can't get rid of them too because user will be entering values in Text boxes, then it is going to change the totals.
The problem with it is, it is always displaying a message and then in excel it is showing the text boxes as it is.
Is there any way to get rid of it? and make it as a plain excel.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Your repeater is always in edit mode...? Strange.
generally what happene. we display data in labels or literals and when we need to edit some record just click on edit button and it become editable.
Simple approach, in this way your export to excel will work absolutely fine.
|
|
|
|
|
No it is not editable all the times, but I didn't use labels at all, instead I made the text boxes enable=false when I don't want them to be enabled.
Isn't it correct approach? My repeater has lot of rows and columns so I didn't want to have more controls on it. Is there any other approach.
Here is my repeater html part, here I am using EnableEdit as property because it will be set when the report is getting loaded. Then depending upon users access level he will have either edit or view feature enabled for him. If I need to change anything in implementing your approach please let me know. It will help me a lot in terms of Excel import. Then below that I am putting the EnableEdit code.
<asp:Repeater ID="rptStateDrawDownsSplit" runat="server" OnItemDataBound="rptStateDrawDownsSplit_ItemDataBound">
<HeaderTemplate>
<header>
<asp:Label ID="Label4" runat="server" CssClass="FormHead2">State Account Tracking</asp:Label>
</header>
<table width="100%" id="tblStateAccountTracking" cellspacing="2" border="1">
<tr>
<td class="ColHeading">Recipient Agency</td>
<td class="ColHeading" nowrap="false" style="width: 6%;">
<asp:Label runat="server" CssClass="ColHeading" ID="lblCarryOverQty" Width="95%" />
</td>
<td class="ColHeading" nowrap="false" style="width: 6%;">
<asp:Label runat="server" CssClass="ColHeading" ID="lblDivertedQty" Width="95%" />
</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Jul White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Jul Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Aug White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Aug Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Sep White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Sep Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Oct White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Oct Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Nov White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Nov Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Dec White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Dec Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Jan White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Jan Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Feb White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Feb Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Mar White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Mar Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Apr White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Apr Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">May White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">May Dark</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Jun White</td>
<td class="ColHeading" style="flex-wrap: wrap; width: 3%;">Jun Dark</td>
<td class="ColHeading" style="width: 6%; flex-wrap: wrap;">Qty Trans Frm Sponr To State</td>
<td class="ColHeading" style="width: 6%; flex-wrap: wrap;">Qty Trans Frm State To Sponr</td>
<td class="ColHeading" style="width: 6%; flex-wrap: wrap;">Qty Trans Frm Procsr To State</td>
<td class="ColHeading" nowrap="true" style="width: 4%">Total</td>
<td class="ColHeading" style="width: 4%; flex-wrap: wrap;">Prior Yr Left Over</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr class="OddRow" width="95%">
<td align="left" style="border: none;">
<%# DataBinder.Eval(Container.DataItem, "RecipientAgency") %>
</td>
<td align="left" style="border: none">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# String.Format("{0:0.00}", DataBinder.Eval(Container.DataItem,"CarryOverQty"))%>'
ID="txtCarryOverQty" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="left" style="border: none">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"DivertedQty")%>'
ID="txtDivertedQty" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JulWhite")%>'
ID="txtJulWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JulDark")%>'
ID="txtJulDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AugWhite")%>'
ID="txtAugWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AugDark")%>'
ID="txtAugDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"SepWhite")%>'
ID="txtSepWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"SepDark")%>'
ID="txtSepDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"OctWhite")%>'
ID="txtOctWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"OctDark")%>'
ID="txtOctDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"NovWhite")%>'
ID="txtNovWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"NovDark")%>'
ID="txtNovDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"DecWhite")%>'
ID="txtDecWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"DecDark")%>'
ID="txtDecDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JanWhite")%>'
ID="txtJanWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JanDark")%>'
ID="txtJanDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"FebWhite")%>'
ID="txtFebWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"FebDark")%>'
ID="txtFebDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MarWhite")%>'
ID="txtMarWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MarDark")%>'
ID="txtMarDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AprWhite")%>'
ID="txtAprWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AprDark")%>'
ID="txtAprDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MayWhite")%>'
ID="txtMayWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MayDark")%>'
ID="txtMayDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JunWhite")%>'
ID="txtJunWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JunDark")%>'
ID="txtJunDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right" style="width: 6%">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"QtyTransFrmSponsorToState")%>'
Enabled="false" ID="txtQtyTransFrmSponsorToState" runat="server"></asp:TextBox>
</td>
<td align="right" style="width: 6%">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"QtyTransFrmStateToSponsor")%>'
Enabled="false" ID="txtQtyTransFrmStateToSponsor" runat="server"></asp:TextBox>
</td>
<td align="right" style="width: 6%">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"QtyTransFrmProcessorToState")%>'
Enabled="false" ID="txtQtyTransFrmProcessorToState" runat="server"></asp:TextBox>
</td>
<td align="right" id="tdTotal" runat="server" style="width: 4%"></td>
<td align="right" id="tdPriorYrLeftOver" runat="server" style="width: 4%">
<%# DataBinder.Eval(Container.DataItem, "PriorYearLeftOver") %>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr class="EvenRow" width="95%">
<td align="left" style="border: none;">
<%# DataBinder.Eval(Container.DataItem, "RecipientAgency") %>
</td>
<td align="left" style="border: none">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# String.Format("{0:0.00}", DataBinder.Eval(Container.DataItem,"CarryOverQty"))%>'
ID="txtCarryOverYear" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="left" style="border: none">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# String.Format("{0:0.00}", DataBinder.Eval(Container.DataItem,"DivertedQty"))%>'
ID="txtDivertedYear" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JulWhite")%>'
ID="txtJulWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JulDark")%>'
ID="txtJulDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AugWhite")%>'
ID="txtAugWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AugDark")%>'
ID="txtAugDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"SepWhite")%>'
ID="txtSepWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"SepDark")%>'
ID="txtSepDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"OctWhite")%>'
ID="txtOctWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"OctDark")%>'
ID="txtOctDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"NovWhite")%>'
ID="txtNovWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"NovDark")%>'
ID="txtNovDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"DecWhite")%>'
ID="txtDecWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"DecDark")%>'
ID="txtDecDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JanWhite")%>'
ID="txtJanWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JanDark")%>'
ID="txtJanDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"FebWhite")%>'
ID="txtFebWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"FebDark")%>'
ID="txtFebDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MarWhite")%>'
ID="txtMarWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MarDark")%>'
ID="txtMarDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AprWhite")%>'
ID="txtAprWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"AprDark")%>'
ID="txtAprDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MayWhite")%>'
ID="txtMayWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"MayDark")%>'
ID="txtMayDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JunWhite")%>'
ID="txtJunWhite" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"JunDark")%>'
ID="txtJunDark" runat="server" Enabled="<%# this.EnableEdit %>"></asp:TextBox>
</td>
<td align="right" style="width: 6%">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"QtyTransFrmSponsorToState")%>'
Enabled="false" ID="txtQtyTransFrmSponsorToState" runat="server"></asp:TextBox>
</td>
<td align="right" style="width: 6%">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"QtyTransFrmStateToSponsor")%>'
Enabled="false" ID="txtQtyTransFrmStateToSponsor" runat="server"></asp:TextBox>
</td>
<td align="right" style="width: 6%">
<asp:TextBox Style="text-align: right" Width="99%" Text='<%# DataBinder.Eval(Container.DataItem,"QtyTransFrmProcessorToState")%>'
Enabled="false" ID="txtQtyTransFrmProcessorToState" runat="server"></asp:TextBox>
</td>
<td align="right" id="tdTotal" runat="server" style="width: 4%"></td>
<td align="right" id="tdPriorYrLeftOver" runat="server" style="width: 4%">
<%# DataBinder.Eval(Container.DataItem, "PriorYearLeftOver") %>
</td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
<tr class="ColHeading">
<td colspan="2">RUNNING TOTALS</td>
<td align="right" id="rtDiverted" runat="server" nowrap="true">Test</td>
<td align="right" id="rtJulWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtJulDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtAugWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtAugDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtSepWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtSepDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtOctWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtOctDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtNovWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtNovDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtDecWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtDecDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtJanWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtJanDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtFebWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtFebDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtMarWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtMarDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtAprWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtAprDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtMayWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtMayDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtJunWhite" runat="server" nowrap="true">Test</td>
<td align="right" id="rtJunDark" runat="server" nowrap="true">Test</td>
<td align="right" id="rtQtyTransFrmSponsorToState" runat="server" nowrap="true">Test</td>
<td align="right" id="rtQtyTransFrmStateToSponsor" runat="server" nowrap="true">Test</td>
<td align="right" id="rtQtyTransFrmProcessorToState" runat="server" nowrap="true">Test</td>
<td align="right" id="rtTotal" runat="server" nowrap="true">Test</td>
<td align="right" id="rtPriorYrLeftOver" runat="server" nowrap="true"></td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
Here is the code to get EnableEdit value, it is stored in ViewState too to avoid more database calls. It seems from your previous message I am doing some small mistake which can improve my repeater control. Please help me, it will help me a lot. Thanks in advance friend.
if ((ViewState["EnableEdit"] == null))
{
int PrgId;
PrgId = int.TryParse(ProgId, out PrgId) ? PrgId : 0;
DataSet dsTemp = SqlHelper.ExecuteDataset(strConnectionString, CommandType.StoredProcedure, "pr_GetWebUserSponsorForUser",
new SqlParameter[] {
new SqlParameter("@UserId", SqlDbType.Int) { Value = UserId },
new SqlParameter("@ProgId", SqlDbType.Int) { Value = PrgId }
});
if ((dsTemp.Tables != null) && (dsTemp.Tables.Count > 0) && (dsTemp.Tables[0] != null) && (dsTemp.Tables[0].Rows != null)
&& (dsTemp.Tables[0].Rows.Count > 0) && (dsTemp.Tables[0].Rows[0] != null))
{
EnableEdit = ((dsTemp.Tables[0].Rows[0][0] != null) && !System.DBNull.Value.Equals(dsTemp.Tables[0].Rows[0][0])) ?
((dsTemp.Tables[0].Rows[0][0].ToString() == "1") ? true : false) : false;
ViewState["EnableEdit"] = EnableEdit;
SponsorId = ((dsTemp.Tables[0].Rows[0][2] != null) && !System.DBNull.Value.Equals(dsTemp.Tables[0].Rows[0][2])) ?
(int.TryParse(dsTemp.Tables[0].Rows[0][2].ToString(), out SponsorId) ? SponsorId : 0) : 0;
if (SponsorId > 0)
{
EnableEdit = false;
ViewState["SponsorId"] = SponsorId;
}
else
{
LoadSponsors();
ViewState["SponsorId"] = 0;
}
}
else
{
LoadSponsors();
EnableEdit = false;
ViewState["EnableEdit"] = EnableEdit;
ViewState["SponsorId"] = 0;
}
}
else
{
EnableEdit = (ViewState["EnableEdit"] == null) ? true : Convert.ToBoolean(ViewState["EnableEdit"]);
SponsorId = (ViewState["SponsorId"] == null) ? 0 : Convert.ToInt32(ViewState["SponsorId"]);
}
<pre>
<div class="signature">Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA</div>
|
|
|
|
|
And another thing about this issue is they didn't say anything about excel export in the beginning now they are asking it. That's another reason may be I didn't look for your option.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|