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

Word 2010 Protected View Annoyances

$
0
0
My users (typically using IE8 or IE9) are downloading DOC/DOCX files from a secure folder in an ASP.NET 4.0 web forms site. The "Trusted Documents" security feature is causing my users to see an "Enable Editing" button which must be clicked before they can edit (or even print) the doc. Problem is, when they click this button Word seems to refetch the document and in the process...loses the fact they are logged in! Thus instead of the document loading a moment later, my "Login Required" web page loads inside Word 2010... D'Oh! | :doh:
 
This is very annoying to users as they must then close the document and redownload it - at which point (having trusted the document already) it opens just fine. Is there a way around this unpleasant user experience? I cannot move the files to any area which wouldn't require a login...and I certainly cannot remove a security feature from end user machines...

Pass textbox value from child window to parent page in asp with out post back in parent

$
0
0
I created an Asp application, for finder option child window is used.when we select the finder option is opened, selected value from grid view is showing the text box(eg..id and name).These two text box values pass to parent page, after selection in child page.while passing from child to parent page, parent should not refresh or postback.

binding gridview

$
0
0
Hi
i bind a gridview and one of the column show the data this form "aaa#;7" i want show just "aaa", how can i remove "#;7" from the end of data in gridview column when it bindings.
 
Thnaks

Transactions in Web applications

$
0
0
How transactions are handled in web applications you worked with? Using ADO.NET [BeginTransaction], Stored Procedure [TCL] or Entity Framework [SaveChanges() to insert, update or delete on the database which is wrapped in a transaction] or any other way? Please share your experiences and learnings on this topic. Thanks a lot in advance.

How to develop a Website

$
0
0
Any idea of a website or any other accessible location to get an idea on how to develop a website for someone who has no knowledge in programming languages?

crystal report

$
0
0
crystal report is working fine on local but giving blank page on server and not giving any exception... :(

passing value betwen pages

$
0
0
Hi, I have 'strange' problem with updating received value from another html page:
Supposing I have two pages A and B.
The Page A sent a value (some component with the
name 'selection') by using method Submit in javascript:
 
Page A
-------
function foo(..) {
...
document.forms["form"].submit();
window.close(); //the page will be closed after sending the value
}
 
Page B recived the value in the Page_Load:
------
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.QueryString.HasKeys())
{
string navigate = Request.QueryString["selection"];
this.tbValue.Text = navigate;
}
}
The variable 'navigate' has the value sent from the page A thus TextBox.Text is set properly by this value inside the method, but finally is NOT displayed for the client Page B. How to handle this problem of refreshing Textbox so that the value is displayed?
thanks for all useful advice.

ASP.NET Data Grid and Data List Click Event

$
0
0
I am designing an online examination question block which is to be displayed in grid , for which I am using Gridview tool. However , each row contains question number which is to be displayed as columns as given below
Currently it is displaying as
1
2
3
4
But I need this to be displayed as
1 2 3 4
 
When the user clicks the question number , corresponding question to be displayed in question block

Client side pagination is not working in jqGrid

$
0
0
Hi Friends,
I am new user for jQuery and jqGrid. I am trying to implement jqGrid with client side pagination. It is not working at my end. I am using .net 4.0 web service to get json respons.
 
This is my web service code
publicstring GetMessage(string FDate,string TDate,string Status)
        {
  databaseDataContext dc = new databaseDataContext();
            var v = (from v1 in dc.WBS_MESSAGEs
                     where v1.TransStatus ==  Status && v1.CreatedDate >= fromDate
                     && v1.CreatedDate <= toDate
                     select new
                     {
                         v1.MessageID,
                         v1.Task,
                         v1.Remark,
                         v1.CreatedDate,
                         Object = (v1.ObjectID == "2" ? "Business Partner" :
                             v1.ObjectID == "30" ? "Journals" : "Unknown")
                     });
            if (v.Count() > 0)
            {
 
                System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
                return js.Serialize(v.ToList());
            }
            else
            {
                returnnull;
            }
    }
 
This is my JavaScript / jqGrid code
 
function callMessage(p0, p1,p2,ctrlName) {
                $.ajax({
                    type: "POST",
                    url: "SAPBOne.asmx/GetMessage",
                    data: '{ "FDate":"' + p0 + '" ,"TDate":"' + p1 + '","Status":"' + p2 + '"}',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    error: function (data) {
                        alert(data.statusText);
                    },
 
                    success: function (data) {
                        var thegrid = jQuery(ctrlName)[0];
                        thegrid.addJSONData(JSON.parse(data.d));
                        // var jSonMessage = JSON.parse(data.d); // data.d is a JSON formatted string, to turn it into a JSON object
// we use JSON.parse
// now that myData is a JSON object we can access its properties like normal
                    }
                });
            };
 
      $(window).load(function () {
                var qString = get_query();
                //Get Success Messages
                jQuery("#jsonmap").jqGrid({
                    url: callMessage(qString.p0, qString.p1,'Success','#jsonmap'),
                    datatype: 'json',
                    colNames: ['Message ID', 'Object', 'Task', "CreatedDate", 'Remark'],
                    ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
                    colModel: [
                                    { name: 'MessageID', index: 'MessageID asc', sortable: true, align: "center", width: 55 },
                                    { name: 'Object', index: 'Object', width: 120, jsonmap: "Object" },
                                    { name: 'Task', index: 'Task', width: 80, jsonmap: "Task", align: "center" },
                                    { name: 'CreatedDate', index: 'CreatedDate', jsonmap: "CreatedDate", align: "center", formatter: 'date', formatoptions: { srcformat: 'yyyyMMdd', newformat: 'd-M-y @ H:i:s' }, width: 140 },
                                    { name: 'Remark', index: 'Remark', width: 300, jsonmap: "Remark" }
                                ],
                    serializeGridData: function (postData) {
                        return JSON.stringify(postData);
                    },
                    loadtext: "Loading...",
                    rowNum:5,
                    rowList: [5, 10],
                    pager: '#pjmap',
                    sortname: 'MessageID',
                    sortorder: "desc",
                    viewrecords: true,
                    gridview: true,
                    loadonce:true,
                    sortorder: "desc",
                    sortname: 'MessageID',
                    caption: "Success",
                    pgbuttons: true,
                    height: 'auto',
                    refreshtext:'Refresh',
                    repeatitems: true,
                    emptyrecords: "No records to view"
                });
                jQuery("#jsonmap").jqGrid('navGrid', '#pjmap', { edit: false, add: false, del: false  });
 

I am stuck here.
 
Your help will be highly applicable.
s

JQuery to get sum of testboxes values of each row in Repeater Control

$
0
0
Hi All,
 
I had been out for a while in Client side programming. I have a repeater control in which I have 12 text values to show for each month, then I have a label in which I want to display the sum of all these Textbox values for each row.
Means the Text boxes will appear first and in the last I have a label.
I want to sum all these textbox values and put it in the label for each row. And whenever textbox value changes that should change the value of label also.
 
Can anybody please help in achieving this? I am also searching. If you know any link etc, please help me. It would save lot of my time.
 
Thanks in advance.
Thanks & Regards,
 
Abdul Aleem Mohammad
St Louis MO - USA

WCF error, System.ServiceModel.CommunicationException the maximum message size quota for incoming messages has been exceeded

$
0
0
We are seeing this error related to an http file transfer request

WCF error, System.ServiceModel.CommunicationException the maximum message size quota for incoming messages has been exceeded.

I've seen several posts related to this message, with the general response of just bump it to the max.

What if you want to force a limit on the file transfer size. We want to allow the user to only transfer files 60MB(62914560) and smaller.

Which setting should be set to 62914560? maxStringContentLength or maxArrayLength?

Is there overhead for the envelope around the request? In other words will the max allowed download file size be 60MB? Or is it smaller, file size + request overhead <= 60MB?

If it is the latter, can this be determined. Is the overhead fixed size? Or is the overhead a function of other settings (eg-maxBytesPerRead)?

Does SSL impact the file (overall message) size? How much?

I'm trying to understand exactly how it works. Changing the size seems arbitrary. How do I know what the correct setting value is to allow downloads of files that are only 60MB or less. One of the things I am seeing is that a zip file of 53776931 bytes will throw the exception. Prior to the download, I'm checking the size of the file and it is clearly less than 60MB. What is causing the message to exceed the maximum message size?

MVC4 - WebMatrix.WebData.SimpleMembershipProvider vs System.Web.Security.MembershipProvider

$
0
0
So... with MVC4 and foreseeable future, you can't use
System.Web.Security.MembershipProvider 
 
And must extend your membership provide by inheriting from:
WebMatrix.WebData.SimpleMembershipProvider
 
or
WebMatrix.WebData.ExtendedMembershipProvider
 
I say you can't extend System.Web.Security.MembershipProvider because you'd run into the following error when "AccountController" calls "WebSecurity.Login":
"membership.provider"property must be an instance of "extendedmembershipprovider".
 
Am I understanding this correctly? You must now use WebMatrix SimpleMembershipProvider? - that System.Web.Security.MembershipProvider is obsolete in MVC space? that it's only suitable for web forms?
 
What's bothering me is, with SimpleMembershipProvider, you must call WebSecurity.InitializeDatabaseConnection at least once - what if I don't store my users in db? What if I just store my users in simple local csv? or xml file?
 
I think I found the answer here - new MVC 4.0 AccountController not compatible with old System.Web.Security.MembershipProvider.[^]. Thank you Uncle Soft! I so enjoy learning new patterns, especially when it does the same thing!
 
The new ASP.NET MVC 4 Internet application template AccountController requires SimpleMembership and is not compatible with previous MembershipProviders
You can continue to use existing ASP.NET Role and Membership providers in ASP.NET 4.5and ASP.NET MVC 4 - just not with the ASP.NET MVC 4 AccountController
The existing ASP.NET Role and Membership provider system remains supported, as it is part of the ASP.NET core

Word 2010 Protected View Annoyances

$
0
0
My users (typically using IE8 or IE9) are downloading DOC/DOCX files from a secure folder in an ASP.NET 4.0 web forms site. The "Trusted Documents" security feature is causing my users to see an "Enable Editing" button which must be clicked before they can edit (or even print) the doc. Problem is, when they click this button Word seems to refetch the document and in the process...loses the fact they are logged in! Thus instead of the document loading a moment later, my "Login Required" web page loads inside Word 2010... D'Oh! | :doh:
 
This is very annoying to users as they must then close the document and redownload it - at which point (having trusted the document already) it opens just fine. Is there a way around this unpleasant user experience? I cannot move the files to any area which wouldn't require a login...and I certainly cannot remove a security feature from end user machines...

MVC4 - WebMatrix.WebData.SimpleMembershipProvider vs System.Web.Security.MembershipProvider

$
0
0
So... with MVC4 and foreseeable future, you can't use
System.Web.Security.MembershipProvider 
 
And must extend your membership provide by inheriting from:
WebMatrix.WebData.SimpleMembershipProvider
 
or
WebMatrix.WebData.ExtendedMembershipProvider
 
I say you can't extend System.Web.Security.MembershipProvider because you'd run into the following error when "AccountController" calls "WebSecurity.Login":
"membership.provider"property must be an instance of "extendedmembershipprovider".
 
Am I understanding this correctly? You must now use WebMatrix SimpleMembershipProvider? - that System.Web.Security.MembershipProvider is obsolete in MVC space? that it's only suitable for web forms?
 
What's bothering me is, with SimpleMembershipProvider, you must call WebSecurity.InitializeDatabaseConnection at least once - what if I don't store my users in db? What if I just store my users in simple local csv? or xml file?
 
I think I found the answer here - new MVC 4.0 AccountController not compatible with old System.Web.Security.MembershipProvider.[^]. Thank you Uncle Soft! I so enjoy learning new patterns, especially when it does the same thing!
 
The new ASP.NET MVC 4 Internet application template AccountController requires SimpleMembership and is not compatible with previous MembershipProviders
You can continue to use existing ASP.NET Role and Membership providers in ASP.NET 4.5and ASP.NET MVC 4 - just not with the ASP.NET MVC 4 AccountController
The existing ASP.NET Role and Membership provider system remains supported, as it is part of the ASP.NET core

PREVIEW ASP.NET PAGE ON A WEB BROWSER

$
0
0
I have developed a web page using asp.net in dream weaver and sql server 2000 but when it comes to displaying the page on a web broswer. it gives the following output. Please help this is my assignment to job a job.
<%@LANGUAGE="VBSCRIPT" AutoEventWireup="true"
CodeBehind="Default.sampl.aspx"
Inherits="WebApplication"%><!--#include file="Connections/asp.asp" --><%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?"& Server.HTMLEncode(Request.QueryString)
EndIf 
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false%><%If (CStr(Request("MM_insert")) = "form1") ThenIf (Not MM_abortEdit) Then' execute the insert
Dim MM_editCmd
 
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_asp_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.login (username, pass) VALUES (?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 60, Request.Form("username")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 60, Request.Form("pass")) ' adLongVarChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
 
    ' append the query string to the redirect URL
Dim MM_editRedirectUrl
    MM_editRedirectUrl = "sampl.asp"If (Request.QueryString <> "") ThenIf (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?"& Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&"& Request.QueryString
      EndIfEndIfResponse.Redirect(MM_editRedirectUrl)
  EndIfEndIf%><% 
Set Command1 = Server.CreateObject ("ADODB.Command")
Command1.ActiveConnection = MM_asp_STRING
Command1.CommandText = "INSERT INTO  ( )  VALUES ( ) "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
 
%><%Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
 
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_asp_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.login"
Recordset1_cmd.Prepared = true 
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0%><%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/><title>Untitled Document</title><styletype="text/css"> 
body,td,th {
    font-family: Verdana, Geneva, sans-serif;
    font-size: 12px;
    color: #30F;
}
a {
    font-family: Georgia, "Times New Roman", Times, serif;
}
 
</style><linkrel="stylesheet"title="Disabled for Preview-in-Browser: css.css"type="text/css"/><styletype="text/css"> 

form {
    font-size: 14px;
    color: #009;
}
body{animation:ease-in-out running;
backface-visibility:visible;
background-image:inherit;
font-family:"Times New Roman", Times, serif;
font-size:14px;
alignment-adjust:central;
border-color:#906;
border-image:auto;
appearance:desktop;
clip:rect(top right bottom left);
}
h1
{ font-family:Tahoma, Geneva, sans-serif;
font: signature;
font-size:large;
}
 

</style></head> 
<body><aname="ASPIRE"id="ASPIRE"></a><div><h1> THIS IS REMARKABLE STEP </h1></div><div><iframesrc="images/icon.fw.png"></iframe></div><hralign="center"size="12"noshade="noshade"color="#CC3300"/><formname="login"><br/><formaction="<%=MM_editAction%>"method="post"name="form1"id="form1"><tablealign="center"><trvalign="baseline"><tdnowrap="nowrap"align="right">Username:</td><td><inputtype="text"name="username"value=""size="32"/></td></tr><trvalign="baseline"><tdnowrap="nowrap"align="right">Pass:</td><td><inputtype="text"name="pass"value=""size="32"/></td></tr><trvalign="baseline"><tdnowrap="nowrap"align="right">&nbsp;</td><td><inputtype="submit"value="SUBMIT"/></td></tr></table><inputtype="hidden"name="MM_insert"value="form1"/></form><p>&nbsp;
</p></body></html><%
Recordset1.Close()
Set Recordset1 = Nothing%>

Window.open

$
0
0
Hi,
 
We develop an ASP.Net Web Application an in some pages we need to open a new url with parameters from javascript with input type=button, my problem is when use the
window.open("url?id='2'&name='xyz'");
the parameters key and value are shown in the url and it is less secure, please help me to use any way to pass parameters without show it in the url, or help me to hide the url content if it is possible.
 
Please help me ASAP.
 
Thanks All

ASP.net - Webforms - Dynamic controls

$
0
0
Ok, so have a task I need to complete asap. in an existing C# web application I have been asked to create a wizard type page.
(only on this page, the steps are stored in a few tables containing - 1) what the step is, 2) the verbatam, 3) the possible responses)
 
So the questions are:
 
how do I dynamically load the controls of the step I am currently looking at.
how do I dynamically read the the values selected to save into a database?
How do I move to the next step?
 
Help!!!
 
Thanks!

Dropdown control doesn't always populate

$
0
0
I have a pair of dropdowns on a asp.net web site. The first dropdown populates when the page renders. The 2nd one populates when something is selected in the first one. My problem is that sometimes, the 2nd dropdown doesn't have anything in it. The drop down part looks like there should be (it's tall enough for about 10 items to be shown), but there is nothing in the box.
 
When the first combo selection changes, this code is run:
 
int id = Convert.ToInt32(this.droplistMarkets.SelectedItem.Value);
        this.Players = new Players();
        this.droplistPlayers.Items.Clear();
        this.droplistPlayers.DataSource = null;
        this.droplistPlayers.DataBind();
        this.Players.Fetch(id); // this is a database query to find all players in the specified market
this.droplistPlayers.DataTextField = "Name";
        this.droplistPlayers.DataValueField = "Id";
        this.droplistPlayers.DataSource = this.Players;
        this.droplistPlayers.DataBind();
        this.droplistPlayers.SelectedIndex = -1;
 
I've verified that the selected item from which the market id is taken is valid, and that the Players object is indeed populated, but the binding fails to work as expected.
 
Any help would be appreciated. Again, this only fails sometimes.
 
EDIT ===============================
 
It's looking like the database query might be the culprit.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

Menu focus

$
0
0
Below is the two hyperlinks, when i click one of them the following events must take place:
-set a focus to the active link
-change the background color of the clicked link
 
I tried to use CSS and JScript but it does not work.
 
please anyone with the solution there ...HELP
  • Home
  •  
  • About Us
  • How to get control inside Datagrid ?

    $
    0
    0
    I have a issue. I want to get the value of label control inside datagrid.
    I show my code
    <asp:DataGrid id="dtgThutuc" runat="server" AutoGenerateColumns="False" CellPadding="4" GridLines="Horizontal"
    BorderColor="#FF6600" BorderWidth="1px" ShowHeader="False" Width="100%" Height="100%" DataKeyField="MaLoaiTT">

    <asp:TemplateColumn>


    <asp:Label ID="lblSTT" Runat="server">
    <%#getCount()%>

    <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.TenTT") %>' ID="lblTen">

    <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.MaLoaiTT") %>' ID="MaLoaiTT" Visible=False>

    <asp:ImageButton Runat="server" ImageUrl="images/1.jpg" ID="cmdMuc1" OnClick="cmdMuc1">




    I want to get the value of "lblTen" control when I click image button "cmdMuc1". please people help me. Thanks a lot
    Viewing all 3938 articles
    Browse latest View live


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