|
You would have to write it in javascript, and run it on the client side if you want to see updates, you can try an update panel, but my experience is that it's 1 transmission to the server, and 1 transmission back, and then you have to do it again. I don't use them anymore.
So you would write your balance program in javascript, and create dynamic html via javascript to run in the report window.
Web programs do not run like windows programs, you have to change the way you think in designing your program mechanics. Shifting over to the client side would more closely mimic a windows program.
You can start by optimizing your program to run faster on the server side, get rid of the bloat first. Perhaps ask a small optimization question next.
A Simple Thread Snippet
http://stackoverflow.com/questions/1824933/right-way-to-create-thread-in-asp-net-web-application[^]
|
|
|
|
|
this is the code
static DataLoadOptions objDataLoadOption = GetDataLoadOpt();
public static DataLoadOptions GetDataLoadOpt()
{
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<clsCustomerWithAddresses>(c => c.Addresses);
dlo.LoadWith<clsAddresses>(clsAddresses => clsAddresses.Phone);
return dlo;
}
this workd fine when i try to call it
objContext.LoadOptions = objDataLoadOption;
var MyQuery = from objCustomer in objContext.GetTable<clsCustomerWithAddresses>()
select objCustomer;
I want to change the loadwith option
for this i used reflection to check the forzen variable in dataloadoptions
var freeze = typeof(DataLoadOptions).GetField("frozen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(objDataLoadOption);
if ((bool)freeze == true)
{
objDataLoadOption = new DataLoadOptions();
objDataLoadOption.LoadWith<clsPhone>(p => p.MobilePhone);
objContext.LoadOptions = objDataLoadOption;
all this works fine. Issue comes after some time. after 2-3 weeks i start getting
LoadWith is not allowed after freeze or attach to DataContext
any idea why i am getting this and how can it be stopped
|
|
|
|
|
You just cannot add load options to already existed context. Add desired options, and then use this context.
No more Mister Nice Guy... >: |
|
|
|
|
|
how can i get the checkbox text from database field name..
for example i have table..
no Fname Mname Lname
1 bilal khatri yousuf
2 faheem chania ali
how can iger the Fname in checkbox1. . . .
|
|
|
|
|
In HTML your output would be like this:
<INPUT TYPE='CHECKBOX' VALUE='1' ID='Name1'><LABEL FOR='Name1'>bilal khatri yousuf</LABEL><br/>
<INPUT TYPE='CHECKBOX' VALUE='2' ID='Name2'><LABEL FOR='Name2'>faheem chania ali</LABEL>
But I am not sure if this is what you want to know.
I wish I could believe there is an after life.
|
|
|
|
|
|
Get the text into a string , split it by space and get the first name. 
|
|
|
|
|
Hi,
A really well written article, which I recommend you look at if you haven't at is Journey through the Javascript MVC Jungle[^].
Here's my dilemma. I want all the goodness of controllers, I want strongly typed views and model binding - basically all the best bits of MVC. However, even a fairly simple page will usually require some client side script for showing\hiding elements, confirmation boxes & all that funky stuff that users expect for todays interactive web pages. You normally end up with 'page specific script' which will be a number of event handlers and bindings, with no real structure as such.
Backbone, Knockout and many of the other frameworks mentioned in the article I linked address this problem, they allow you to create client side models and bring structure and cohesion to your client script. However, the way they are designed almost relegates MVC to a simple 'web API' to handle RESTful requests and respond with some JSON. You seem to end up moving logic that I believe should be in the 'server side controller' into a 'script controller', which I'm not really happy with.
I want a structured script representation of my Model, that wires up all by event handlers for my View and keeps everything in a logical order. But I still want model binding, data annotations, validation and logic in my controller, everything that should be handled by MVC.Net. I want the best of both in other words
I've read quite a bit on this subject, so I know there are many different options available to me - that's the very point of the link. I'm just interested how others developing in MVC are addressing this problem?
Most of the applications I'm working on at the moment are Line Of Business, but they can still have some fairly complex client side functionality. I'm not using any framework at the moment, I'm just namespacing my script and wrapping up some jQuery (i.e. Javascript modular pattern) ... it works, just not sure if it's the best way to be doing things.
Any thoughts?
Cheers
|
|
|
|
|
I'm using revealing module pattern and knockout
js file contains viewmodel something like this
var viewmodel = function (){
model = ko.mapping.fromJS([]),
init = function(initialData) {
model = initialData;
},
save = function(data, event) {
$.ajax({
});
},
delete = function(data, event) {
$.ajax({
});
};
return{
Init : init,
Save : save,
Delete : delete
};
};
view contains script to initialize viewModel and bindings
$(document).ready(function () {
viewmodel.Init(Model.toJSON());
ko.applyBindings(viewmodel);
});
Not sure if it's the best way but it works.
- Regards - J O N
|
|
|
|
|
|
that's exactly right. .NET Model is converted into JSON object and passed on to the Init function. In the Init when we do something like this we get the exact representation of the .NET Model in a javascript object with all items as knockout observables which is nice for a two-way binding.
model = ko.mapping.fromJS(initialData);
or
model = ko.wrap.fromJS(initialData);
- Regards - J O N
|
|
|
|
|
I have a textbox with multiline, i want to implement a feature in which i click a hyperlink or button then the whole content or selected content of textbox get copy to the clipboard.
Thanks In Advance,Appreciates your help
Vinay Sinha
|
|
|
|
|
Hi all, I am trying to create textboxes dynamically and I came across a method that does mostly what I want while searching for a solution on line. The method below is what I've found
for(int i = 0; i<boxes; i++)
{
TextBox tb = new TextBox();
tb.Location = new System.Drawing.Point(40, 120 + i * 20);
tb.Name = "TextBoxName" + i.ToString();
tb.Size = new System.Drawing.Size(184,20);
tb.TabIndex = i + 2;
tb.Text = String.Empty;
panel1.Controls.Add(tb);
}
The problem with the above code snippet is that sending values placed inside of the created textboxes to a database is difficult because the textboxes all have the same name. If each textbox can be given a different name when it is created, it will be great. Any suggestion is greatly appreciated, thanks in advance
|
|
|
|
|
Would you please explain how all textboxes have same name. The loop clearly says that every textbox created has index associated with its name. First textbox name reads "TextBoxName1", second reads "TextBoxName2" and so on. Where is the issue you are facing?
Thanks & Regards,
Vani Kulkarni
|
|
|
|
|
why dont u provide id of the texbox:
tb.ID="txtBox" + i;
u just pick id for your any operation.It will be unique.
I have replied as much i understand your problem.
|
|
|
|
|
The problem u have is how to access the dynamically created textboxes, isn't it
ok
look, the code u had written actually creates a number of objects of type TextBox, and give every one a name that is 'TextBoxName1', 'TextBoxName2',.. etc
the problem here is how to access the objects created.
so, you must declare a generic dictionary of string and TextBox on the class level, means
Dictionary<string,TextBox> AllTextBoxes = new
Dictionary<string,TextBox> ();
this code will be in the class level not inside any methods.
the second step is to add a line inside the loop to add items to this dictionary, each of them consists of a key and a value, the key is the name of textbox, while the value is the textbox object created in each loop, this line will be at the end of loop,
AllTextBoxes.Items.Add("TextBoxName" + i.ToString(), tb);
now, u can access any textboxe through the dictionary when giving the name of textbox like this
string aaa = AllTextBoxes["TextBoxName1"].Text;
I hope this is usefull
Dr Sayed Tohamy, Egypt
|
|
|
|
|
For starter I don't think that code you posted above is for asp.net. html TextBox control don't have size and location properties (this is controlled by css class and some css styles). Second, don't you think that placing in a loop with "i" index and appending this index name, give each text box unique name?
No more Mister Nice Guy... >: |
|
|
|
|
|
Take a look at the properties IsNamingContainer - then tweak how you're adding the text boxes, then FindControl will more than likely look attractive
C# has already designed away most of the tedium of C++.
|
|
|
|
|
|
|
Classic car or Sports car?
Which one do you want?
why?
- Regards - J O N
|
|
|
|
|
|
Because gas is expensive? :p
No more Mister Nice Guy... >: |
|
|
|
|
|
Help me
I am using jquery ui autocomplete but it's not working
i write this code
web page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="./Script/jquery-ui-1.8.1.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="./Script/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="./Script/jquery-ui-1.8.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tbAuto").autocomplete({
source: function(request, response){
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebService.asmx/getDepartementName",
data: "{'Name':'" + request.term +"'}",
dataType: "json",
async: true,
success: function(data){
response(data.d);
},
error: function(result){
alert(result);
}
});
},
minLength: 1
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="demo">
<div class="ui-widget">
<label for="tbAuto">department name :<asp:TextBox ID="tbAuto" runat="server"></asp:TextBox> </label>
</div>
</div>
</form>
</body>
</html>
web service -
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.Script.Services
Imports System.Collections.Generic
<ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService
Dim con As New dbConnection
Dim da As OleDbDataAdapter
Dim tempDT As New DataTable
Dim SQL As String
Dim rows, i As Integer
Dim DepNames As New List(Of String)
<WebMethod()> _
Public Function getDepartementName(ByVal prefixText As String) As String()
Try
con.connect()
SQL = "select DEPARTMENT_NAME from TBLDEPARTMENT_1 where upper(DEPARTMENT_NAME) like upper('%" & prefixText & "%')"
da = New OleDbDataAdapter(SQL, con.con)
da.Fill(tempDT)
rows = tempDT.Rows.Count
If rows > 0 Then
For i = 0 To rows - 1
DepNames.Add(tempDT.Rows(i)(0))
Next
End If
Return DepNames.ToArray()
Catch ex As Exception
Throw ex
End Try
End Function
this webservice is works with ajax autocomplete extender but not with jquery
this not gives any error and not call webservice method.
thanks
|
|
|
|
|
Did you debug and see the execution flow?
Just a thought, may be the URL provides is not properly formed/resolved.
|
|
|
|