|
Maybe I'm confused, but this post is in ASP.NET Web Development. Right?
In ASP.NET Web development, there is no BindingSource. (or am I crazy ?)
There is SQLdatasource (and other datasources).
Is this Post supposed to be in the Windows Development area?
If you need help with SQLdatasource, I can offer some assistance; just need a code example.
David
|
|
|
|
|
Thanks, you are correct, BindingSource is probably specific to win forms and not one of the many shared classes with asp.net. I will repost in the win dev area, this problem is specific to the BindingSource implementation.
|
|
|
|
|
<div class="container">
<iframe>
<html>
<body contenteditable="true">fddsfg fds dgdfgdsgfdsgds
</body
</html>
</iframe>
</div
https://stackoverflow.com/questions/1125292/how-to-move-cursor-to-end-of-contenteditable-entity
I tried above link in both ways like below.
setCaretToEnd('.richeditor .container');
//var s= $('.richeditor .container');
//setEndOfContenteditable(s);
but, Still, the cursor is nr working...Any help appreciated.
|
|
|
|
|
My code looks like below.How to focus cursor at the end of iframe body when page loads.
#documnt
<html>
<hrad></head>
<body> aaaaaaaaaa bbbbbbbbbb ccccccccc dddd eeeeeeeeeee</body>
</html>
Thanks for your answer.
|
|
|
|
|
What do you mean by "cursor"? If you mean the mouse pointer then you can't control that, if you mean the caret then html doesn't support that, only text boxes do.
|
|
|
|
|
Good Afternoon,
I am working on a project where I will need a custom control added to a site. Since I have never worked with them previously, I decided to try and make a very basic control and a test site so I can learn how to do everything properly. For instructions, I was using the steps outlined on Microsoft's website here. Therefore I created a solution with two projects - Custom Control Assembly and Custom Control Test Site, both of which are using the 4.7 version of the .NET Framework.
For the Custom Control Assembly, the Assembly name is CustomControlAssembly and the Default namespace is CustomControlNamepsace. There is one file in the project called CustomControl which inherits from
System.Web.UI.Control . This project built without any errors and I copied the CustomControlAssembly.dll to the /Custom Control Test/Custom Control Test Site/bin folder as instructed on the Microsoft page listed above.
The Custom Control Test Site is a web forms site. On the Default.aspx page I added the following directive right underneath the
<%@ Page %> directive:
<%@ Register TagPrefix="Custom" Namespace="CustomControlNamespace" Assembly="CustomControlAssembly" %>
In the page, I am able to add the following tag and IntelliSense correctly finds it:
<Custom:CustomControl runat="server"></Custom:CustomControl>
However, if I try to add an ID properties (in order to name it like I do with all ASP.NET controls), like the following:
<Custom:CustomControl runat="server" ID="CustomControl1"></Custom:CustomControl>
I get the following error message:
CS0400 - The type or namespace name 'CustomControlNamespace' could not be found in the global namespace (are you missing an assembly reference?)
If I take the ID="CustomControl1" out of the tag, then the site will build fine again. However, when I run the site, the custom control does not show anything on the site. I tried updating the CustomControl to inherit from
System.Web.UI.UserControl instead of
System.Web.UI.Control but it still doesn't display on the Default.aspx page. The following is the markup of the CustomControl.ascx file:
<pre><%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomControl.ascx.cs" Inherits="CustomControlNamespace.CustomControl" %>
<table>
<tr>
<td>First Name:</td>
<td><asp:TextBox runat="server" ID="txtFirstName"></asp:TextBox></td>
</tr>
<tr>
<td>Last Name:</td>
<td><asp:TextBox runat="server" ID="txtLastName"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" style="text-align: center"><asp:Button runat="server" ID="btnShowName" Text="Show Name" OnClick="btnShowName_Click"/></td>
</tr>
</table>
<br/>
<br/>
<asp:Label runat="server" ID="lblFullName"></asp:Label>
And the code-behind is:
using System;
namespace CustomControlNamespace
{
public partial class CustomControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnShowName_Click(object sender, EventArgs e)
{
string firstName = txtFirstName.Text.Trim();
string lastName = txtLastName.Text.Trim();
string fullName = $"Hello {firstName} {lastName}! If you are seeing this message, then the custom control " +
$"is working successfully.";
lblFullName.Text = fullName;
}
}
}
So I have two errors - First, why can't I added an ID to the custom control and second, and more importantly, why is the custom control not showing on the Default.aspx page even though the control and site built fine, without any errors or warning. Even when I inspect the HTML of the Default.aspx page, where the control should be, it is just empty.
Any help, guidance, or suggestions would be greatly appreciated. I have been at this for over an hour and a half and can't find anything that would explain why these issues are occurring. Thanks in advance for any help you can provide.
A black hole is where God tried to divide by zero.
There are 10 kinds of people in the world; those who understand binary and those who don't.
|
|
|
|
|
Imagine the following scenario:
1) the user clicks on a button 2) the application does download file in the OnExecute action 3) after some time, the download is done and the user shall see a confirmation-message, that everything was going right.
The process should be asynchronous and should be visualized in some way (for example, with a progress bar), in other words the end-user may work with other parts of the application (Like working with other tabs in web application)during a heavy download process, watch the process status and he will be notified about the process completion.
Any Suggestions on how to implement this scenario?
$('#btnExport').on('click', function (e)
{ window.location.href = "/Export/GetExport; }
public void GetExport(){ //Downloads Data }
The file gets downloaded but the user has to wait until the files gets downloaded. I want free the UI so that user can perform other operations during the download.
|
|
|
|
|
That's not possible as browsers control file downloads for security reasons. For your page to react to the download it would need a hook into the download process which it simply doesn't have.
|
|
|
|
|
If you can drop support for old browsers - including any version of Internet Explorer - then something like this might work:
Javascript - Downloading Files with AJAX and Showing a Progess Bar[^]
NB: If the user navigates away from your page whilst the file is downloading, the download will be aborted. It's generally much safer to use the standard file download options, which will let the browser continue downloading the file in the background whilst the user continues working.
You'll also want to make sure that you add the SessionStateAttribute[^] to your Export controller to disable session state, or set it to read-only. Without that attribute, only one request for a single session can be processed at a time.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I did try by applying [SessionState(SessionStateBehavior.ReadOnly)] to the Export Controller but when I click on download and navigate to another pages(download process is being prepared like getting data from database and loads into excel and then downloads) download stops.
How to achieve this?: the standard file download options, which will let the browser continue downloading the file in the background whilst the user continues working.
|
|
|
|
|
you can use hangfire to do that
=====================================================
The grass is always greener on the other side of the fence
|
|
|
|
|
In my ASP.Net (C#) webforms application, I've noticed that some (all?) of the generated form fields have an extra attribute, "wtx-context" with a GUID value; e.g.
<input type="submit" name="ctl00$grdConfig$ctl04$btnAdd" value="Add New" id="btnAdd" wtx-context="FC3AB902-A74E-4209-8E0D-9F9AC5F15021"> I don't recall ever seeing this in any other of my sites, yet it's happening when running the site via VS2015's development server, and when running on a remote shared host. Searching Google for "wtx-context" returns virtually nothing, and nothing relevant.
Has anyone else come across this, what does it do, and is it an issue?
Confused!
|
|
|
|
|
Hi,
I'm seeing this too - did you ever figure it out?
Ben
|
|
|
|
|
No, never got to the bottom of it. I still see it occasionally, but not as much... Still no useful info when googling, though at least one other dev has seen it some time ago.
|
|
|
|
|
I am trying to insert HTML elements dynamically into an empty DIV element on my VB.net web form when buttons are clicked. Each button will insert a different set of elements. In my jQuery function I made sure the DIV that will receive the new contents is cleared before adding new contents to it.
This works if I take the script and markups and put them in a regular html file but when I try this in my VB.net web form, the new elements show up for a split second then they are cleared.
I think it has to do with PostBack so I put the code below in Pageload.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then
ClientScript.RegisterHiddenField("isPostBack", "1")
End If
End Sub
Then in my jQuery document ready function I check for PostBack with the following code
var isPostBackObject = document.getElementById('isPostBack');
if (isPostBackObject != null) {
}
What am I doing wrong, why isn't it working?
modified 2-Dec-18 11:21am.
|
|
|
|
|
Chances are your code is instigating a postback which is causing the page to refresh. In the javascript you run when the button is clicked make sure the function returns false, or if you're using jquery then use e.preventDefault().
You can probably google "javasctipt prevent postback" for specific code examples.
|
|
|
|
|
Hey can someone kindly help me create models views and controllers using C sharp to write the code
|
|
|
|
|
Did you want to describe the problem your having with more detail?
As it stands now, there's really nothing for anyone to say other than to tell you to either find MVC tutorials on the web or pick up a book on MVC.
|
|
|
|
|
I need help adding html helpers,partial pages,JavaScript ,DbInitializer
|
|
|
|
|
As Dave already suggested, you need to Google for articles or get hold of a good book. No one here is going to do the work for you.
|
|
|
|
|
|
I currently have a solution which contains two projects: an ASP.NET site and a Web API project. On the site, I have a page that is meant to call the API using the POST method at address http://localhost:52855/api/v1/GetPrices asynchronously (e.g. response = await base.SendAsync(request, cancellationToken where "base" is a DelegatingHandler). Part of the data that is posted is an API key along with a signature to ensure the user is authorized. However, nothing happens; the Chrome tab just shows the loading symbol continuously.
But, if I use Fiddler and make a POST request to the same address (http://localhost:52855/api/v1/GetPrices), but without the API/signature information, I get back the correct response - a 401 Unauthorized and a "WWW-Authenticate: amx" header (where "amx" is the authentication scheme I'm using for testing. If I include the authorization header in Fiddler then I get a 500 Internal Server Error
My biggest question is how can I debug the Web API project in Visual Studio 2017 Enterprise edition? I have breakpoints set on all the methods (e.g. the Post method in my GetPricesController : ApiController as well as my HMACAuthenticationAttribute which implements the IAuthenticationFilter). I feel that if I can at least start seeing what's going on when I make the requests with Fiddler, that I may be able to figure out the web app from there.
I'm supposed to be doing a demo on this Web API project tomorrow early afternoon and I've been working for the back 11 hours on finishing this up but I'm completely stalled now and have no idea where to go from here. Any help/guidance would be so greatly appreciated. Thank you.
P.S. I was using this article http://bitoftech.net/2014/12/15/secure-asp-net-web-api-using-api-key-authentication-hmac-authentication/ to implement the API key validation.
A black hole is where God tried to divide by zero.
There are 10 kinds of people in the world; those who understand binary and those who don't.
|
|
|
|
|
Hi,
To debug your API you can write another console application which calls your API. Set the api url to your localhost address, then run your WEB API project(by setting the start project on it), now when you run your console application and call your API, your break point will work
|
|
|
|
|
guys Can you help me with this issue i do not know how to write EditItemTempalte in gridView wih sqlCommand !!!!!can you give me sample code
modified 26-Nov-18 3:31am.
|
|
|
|
|
Are list contents volatile ? e.g I've declared a list
Dim AdminFinalFilename As New List(Of String)
On a button press I pass a string into the list
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
finalfilename = DateTime.Now.ToString("ddMMyyhhmm") + "_" + FileUpload1.FileName
AdminFormFilename.Add(finalfilename)
End Sub
On pressing another button the contents of the list disappear
Protected Sub FormSubmit_Click(sender As Object, e As EventArgs) Handles FormSubmit.Click
If AdminFinalFilename Is Nothing Then
Else
Dim i As Integer
For i = 0 To AdminFinalFilename.Count - 1
Dim y As New accessadminreq
y.InsertAdminUpload(FormID, (AdminFinalFilename.Item(i)))
Next i
End If
End Sub
|
|
|
|