|
Thanks Afzaal for your response. I went through your article and observed that it was about connecting to a local database as oppose connecting to remote database via a Web API.
IsoftTech
|
|
|
|
|
Sorry for any problem you had to face, but the article had a section the connection string section. That depicts the usage of a connection string to connection to remove databases. If you go to the connectionstrings website then you would see how to connect to a remote database, remaining code is similar, the only thing to worry about is the connection string. Did you try that out?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Server Error in '/' Application.
Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.
Source Error:
Line 26: cmd.Parameters.AddWithValue("@ecat", cat);
Line 27: cn.Open();
Line 28: int i= cmd.ExecuteNonQuery();
Line 29: cn.Close();
Line 30: return i;
Source File: c:\domains\Paystole.com\wwwroot\App_Code\Dal\DEduCat.cs Line: 28
Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1081596
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +167
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +113
DEduCat.DInsert(String cat) in c:\domains\Paystole.com\wwwroot\App_Code\Dal\DEduCat.cs:28
BEduCat.BInsert() in c:\domains\Paystole.com\wwwroot\App_Code\Bal\BEduCat.cs:33
Admin_Education.bntSave_Click(Object sender, EventArgs e) in c:\domains\Paystole.com\wwwroot\Admin\Education.aspx.cs:80
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1025
|
|
|
|
|
|
My ASP.NE Test Page is as follows:
TestPage.aspx:
<%@ Page Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="TestPage.aspx.vb" Inherits="TestPage" title="Test Page"%>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:content id="Content1" contentplaceholderid="MainContent" runat="Server">
<asp:toolkitscriptmanager id="ToolkitScriptManager1" runat="server">
Test Page
<asp:updatepanel id="UpdatePanel1" runat="server" updatemode="Conditional">
<contenttemplate>
<asp:textbox id="txtAddress" runat="server" height="16px" width="200px"><input id="btnSelect" type="button" value="Select" onclick="AddTextBox();" />
<asp:button id="btnSave" runat="server" text="Save">
<script type="text/javascript">
function GetDynamicTextBox(textboxValue) {
//alert('Debug 01' + textboxValue);
var width = document.getElementById("ctl00_MainContent_txtAddress").style.width;
return "<input name = 'Text1' type='text' value = '" + textboxValue + "' style='width:" + width + "';/>"
//alert('Debug 02' + width);
}
function AddTextBox() {
var thisAdd = document.getElementById("ctl00_MainContent_txtAddress");
if (thisAdd.value == 0) return false;
var div = document.createElement('DIV');
div.innerHTML = GetDynamicTextBox(document.getElementById("ctl00_MainContent_txtAddress").value);
document.getElementById("targetDiv").appendChild(div);
document.getElementById("ctl00_MainContent_txtAddress").value = '';
}
function RecreateDynamicTextboxes() {
var txtValues = eval('<%=TxtValues%>');
alert('Debug 02: ' + txtValues);
if (txtValues != null) {
var html = "";
for (var i = 0; i < txtValues.length; i++) {
html += "" + GetDynamicTextBox(txtValues[i]) + " ";
}
document.getElementById("targetDiv").innerHTML = html;
}
}
function pageLoad() {
RecreateDynamicTextboxes();
}
</script>
Now Code Behind (TestPage.aspx.vb) is as follows:
Imports System.Data.SqlClient
Imports System.Web.Script.Serialization
Partial Class TestPage
Inherits System.Web.UI.Page
Protected TxtValues As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Dim serializer As New JavaScriptSerializer()
Dim textboxValues As String() = Request.Form.GetValues("Text1")
Me.TxtValues = serializer.Serialize(textboxValues)
End Sub
End Class
If I remove "UpdatePanel" and then run it, enter some text in the textbox, click "select" and do this for a few lines and finally click "Save", the PostBack returns the text lines entered.
But when I add "UpdatePanel" back in then it fails on line:
var txtValues = eval('<%=TxtValues%>'); of javascript "function RecreateDynamicTextboxes()" i.e. TxtValues contains nothing after PostBack.
Can I request if someone can suggest ways to make this work please?
mbmirza
|
|
|
|
|
That was way too much code to post and for someone like me to go through.
Plus you didn't wrap your code in <pre></pre> tags to say this is code.
function RecreateDynamicTextboxes() {
var txtValues = eval('<%=TxtValues%>');
alert('Debug 02: ' + txtValues);
if (txtValues != null) {
var html = "";
for (var i = 0; i < txtValues.length; i++) {
html += "
" + GetDynamicTextBox(txtValues[i]) + "
";
}
document.getElementById("targetDiv").innerHTML = html;
}
}
I didn't see a TxtValue in the HTML. All I see is a TxtAddress as something that can postback to the server.
FYI:
When you post back to the server, only the original HTML form elements that the server sent can postback to the server. Dynamic elements created in Javascript cannot post back to the server, because the server dodn't know that they exists.
On a partial postback, or update panel, just the content in the container postback to the server. anything outside the container does nothing.
If you want to use an input element like TxtValue, create it like the TxtAddress and just hide it so it post back.
|
|
|
|
|
Apologies as HTML tags were removed when I added the code. I expected someone will simply cut and paste the .aspx and .aspx.vb pages and run the code.
Basically its a simple example containing a single textbox with a button next to it "select". All of this is inside an Update Panel which inside the Content Page of the Master Page.
The user enters some text in the text box and clicks select button, which calls Javascript routine - AddTextBox which creates a dynamic textbox underneath the orignal textbox and copies the value of text to it. User may continue to add as many text boxes as required and finally click the "Save" button.
The server then processes the dynamic textbox array as follows:
Dim serializer As New JavaScriptSerializer()
Dim textboxValues As String() = Request.Form.GetValues("Text1")
Me.TxtValues = serializer.Serialize(textboxValues)
So the values of textboxes are simply returned in string variable called "TxtValues".
On return the client extracts the values from the variable TxtValues and loops round to redisplay all textboxes as they were originally shown. This is done in Javascript routine - RecreateDynamicTextboxes and the code as you rightly pointed out is:
var txtValues = eval('<%=TxtValues%>');
The problem is that if I remove Update Panel then it all works fine the script reads all textbox values from the variable TxtValues, loops round and re-displays the textboxes. But when I add back the Update Panel the string variable TxtValues contains nothing because the variable is outside of the Panel.
Now I have discovered that if I place the "Save" button outside of the panel then that works but then the whole page blinks which is the main reason I want to use Update Panel.
mbmirza
|
|
|
|
|
So TxtValue is dynamic?
If so, it will never post back to the server, seriously.
You would have to transmit the data via JQUERY Ajax and JSON to a web service, which updates the database.
Or stuff the data in a textbox that comes off the server, and delimit the values to post it back.
Or write a json format text stream to the textbox, and decipher it on the server side.
Feel free to ask for any clarification
|
|
|
|
|
I'm currently designing a page using ASP.NET and JQuery which is very similar to an order form. The page has two ASP.NET Panels; the first one contains ASP.NET controls for some general information. These controls all have validators associated with them, all part of the validation group "vgRequest", along with a validation summary control which is also part of the vgRequest group.
The second Panel contains only HTML text boxes (<input /> ) and two buttons (<button />) . When one of the buttons is clicked, it is supposed to call a JQuery function, however the HTML button is causes the ASP.NET validators to run.
I do not want this to happen as at the very end of the page there is another ASP.NET button which should cause the validation to run. I have tried setting the EnableClientScript property on the validation summary control to False but this didn't help. I've also tried searching on Google but everything I've come across talks about using <asp:Button /> controls.
Is there anyway to prevent normal HTML controls from causes the ASP.NET validators to run? I know I could use <asp:Button /> and set the CausesValidation property to False, but I don't know if this is an option. I'm using the Knockout library and the button I currently have is <button runat="server" data-bind='click: addLine'>Add Line</button> but I haven't figured out a way to add the data-bind='click: addLine' to an ASP.NET button (I have tried OnClickClient='addLine' but this didn't work either.
Any suggestions or information that can help resolve this issue would be greatly appreciated.
Thank You
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.
|
|
|
|
|
It sounds like your addLine function isn't preventing the default click action. As a result, the button will submit the form, which will cause the validators to run on the server.
According to the Knockout documentation[^], if your addLine method returns true , the default click action will run.
Adding the binding attribute to an ASP.NET button should be as simple as:
<asp:Button runat="server"
CausesValidation="false"
Text="Add Line"
data-bind="click: addLine"
/>
Any attributes which don't map to properties on the control will be passed through unchanged.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Just a stab in the dark here.
onClientClick="jquery_validate(); return false;"
The return false cancels the button click event, which in turn cancels the validation.
[edit]
Or you use a non-button like an image or span element, and bind the click in the jquery validator or the document.ready, so it doesn't act like a HTML button, but fires the event. I think you can fabricate a button using span and some css.
|
|
|
|
|
Hi,
I've a quick question -
I'm having 3 pages - 1) Master Page, 2) Header Page(UserControl) 3)Home Page
I'm using header user control as header tag in master page, and then home page is called from master page as well.
I'm not using header user control page in home page. but my requirement is to call a function in header page from Home page on a button click. How can I do this ?
Need help on this please
|
|
|
|
|
- Make sure the function in the header UserControl is public;
- Add a public property to the code-behind for your master page to expose the header UserControl, using the type defined in the UserControl's code-behind;
- Add the
@MasterType directive[^] to your home page to specify the type of the master page; - You will then be able to access the new property from the home page's
Master property, and from that you will be able to access the function:
Master.HeaderControl.YourFunction()
How to: Reference ASP.NET Master Page Content [^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I do't understand clearly if you can explain more or try post your code.
but maybe you can try use the public word for your function
|
|
|
|
|
Hello Everyone
How to make a Video calling pop up (eg. Skype)if user calls to another user need show a popup window Accept/Deny
Very Urjent
Kindly do the needful
|
|
|
|
|
|
There is a lot of code required to do this and there are likely some samples online; however, we can't just hand you all the code.
What we can do is answer specific questions once you get started and then get stuck on something specific.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello I am new to linq i want to get a data from the store procedure want to show in page load
Kindly do the needfull very urjent
modified 7-Feb-15 16:09pm.
|
|
|
|
|
Member 11084469 wrote: i want to get a data from the store procedure want to show in page load
You have our permission. Go ahead.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Member 11084469 wrote: very urjent No, it's not urgent at all.
|
|
|
|
|
We can't give you the code for many reasons, some of which are that we don't know what your stored procedure is named, what your classes are named or any of your variables.
However, I can tell you that this is one of the most basic things to do with Linq so if you just google c# linq examples, you'll find many samples you can then use to see how to do what you want.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
hi,I have a ms word,s templete form and i want export data from Textbox and rich Textbox to special area in Msword,s Templete Form,please help me!
|
|
|
|
|
Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Dear Sir, I am Danish Habib and i get struck with an issue and i have placed my question in many forums but no one still replied to me which is consider as best solution ,The problem statement is below
I have a web application in which i have users and user have the following information (userid,name,email,Passowrd,SecurityQuestion,SecurityAnswer,District,Tehsil,UC,Villages)
So the business rules are as follows
1-One user can have one or more districts
2-One user can have no or many tehsils.
3-One user have have no or many ucs.
4-One user can have no or many villages
these are cascade in nature like that
District------>populates------->Tehsisl
Tehsils-------->Populates ------->UCs
UCs-------------->populates------Villages
So i have made four tables one for basic infromation of user like (userid(P),name,email,password,securityquestion,securityanswer)
4 more tables are DistrictVSUsers(Userid(F),DistrictID(P),DistrictName)
TehsilsVsUser(Userid(F),Tehsil(ID),TehsilName,DIstrictID(F))
UCsVsUser(Userid(F),UCID,UCNAME,TEHSILID(F))
VillageVsUSers(USerid(F),VillageID,Villagename,UCID(F))
These are five table nor four ...
These table are for saving purposes for showing the cascaded records i have used checkboxlist on selection of district checkboxlist the tehsil checkboxlist will populats and on selection of tehsil checkxboxlist the uc checkboxlist populats and on selection of uc checkboxlist the villages checkboxlist item populates ...so this working fine ..
Now For saving the data I am using the loop first loop goes for district and save all the district then the next loop for tehsil and then the next for UC and then the next for Villages .................
So I have assigned one user with 71 villages and now when on edit i want to show the check box checked whose values are present into the database i am getting 71 rows using data reader
"SELECT U.UserId,U.[Address],U.City,u.Country,UT.TehsilId,UC.UCID ,UC.UCName,UV.VillageId ,UV.VillageName ,UT.TehsilName,U.DistrictId,UD.DistrictName ,UD.DistrictId ,UD.UserId,U.FullName,U.IPAddress,U.IsActive,U.IsAdmin,U.IsPasswordReset,U.IsReportable,U.IsVisible,U.CreateDate ,U.Mobile,U.Password,U.ReporintPerson,U.SecurityAnswer,U.SecurityQuestion ,U.UserId,U.Email,U.UserTypes FROM Users U
INNER JOIN UserDistricts UD ON UD.UserId=U.UserId AND UD.DistrictId=U.DistrictId
INNER JOIN UserTehsils UT ON UT.UserID=U.UserId AND UT.DistrictId=UD.DistrictId
INNER JOIN UserUcs UC ON UC.UserID=U.UserId AND UC.TehsilId=UT.TehsilId
INNER JOIN UserVillages UV ON UV.UserId=U.UserId AND UV.UcID=UC.UCID
WHERE U.UserId =26
"
Now i loop from the first row and get the district id which is comming then pass that district id to a method which find all tehsils associated with that district and then select the tehsil whose value comming with datareader first row and pass that tehsil to a mthod which find all ucs assocaited with that and then select the selected and then pass the Uc id to a method to find associated villages and then checked if the first row having that value this all process is done for all rows if i have 70 rows and 70 time this process goes and makes the application very slow please assist me and give me your email to show you the code
|
|
|
|
|
The reason you are not getting any answers is that you are not asking your question in a way that makes it easy to understand. You are also not even asking any real question at all. You are simply stating a bunch of facts... And then saying "It's slow, help me".
You will get much better results if you rewrite your question with very specific questions, and provide only the code necessary to recreate the problem. Ask questions that can be answered explicitly, not open ended questions.
We don't know what to do with "It's slow, please help me".
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|