|
|
Thats the whole issue mate. If I say
Show(this) or ShowDialog(this) I get the error which says
"Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog."
Ohh I better ask Uncle Google instead.
Cheers
|
|
|
|
|
you need to set the IsMdiContainer (IIRC) property to true in the parent form.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Good Day All
I have a Method that i have defined that i will access in JavaScript(Page Method) and its defined like this
[WebMethod, System.Web.Script.Services.ScriptMethod]
public static void Getadata(String StrSearch)
{
View obj = new View();
obj.Bind_SearchBox(StrSearch);
}
And the Bind_SearchBox() method is a non static method that is defined in this code behind of this page and View is the class name of the Page. Now i debugged this and i see the results are passed to the method and the Method is Defined like this
public void Bind_SearchBox(String Search)
{
ViewerService.ViewerService obj = new ViewerService.ViewerService();
String SessionKey = obj.newSession();
DateTime Date1 = Convert.ToDateTime("1980-01-01");
DateTime Date2 = Convert.ToDateTime("2012-12-31");
ViewerService.extract extract = obj.getObjects(SessionKey, Search, Date1, false, Date2, false, "", "");
try
{
RadPanelBar1.Items.Clear();
RadScheduler1.Appointments.Clear();
int Len = extract.set.Length;
for (int i = 0; i < Len; i++)
{
ViewerService.vertex value = extract.set[i];
String PanelClass = value.meta;
PanelClass = PanelClass.Replace(Remstr, "");
PanelClass = PanelClass.Replace(Remstr2, "");
Appointment app = null;
if (value.atom != null)
{
RadPanelItem pane = RadPanelBar1.Items.FindItemByText(PanelClass);
if (pane == null)
{
RadPanelItem nwpane = new Telerik.Web.UI.RadPanelItem(PanelClass);
RadPanelItem nwpaneSpliter = new Telerik.Web.UI.RadPanelItem(PanelClass);
nwpaneSpliter.IsSeparator = true;
RadPanelBar1.Items.Add(nwpane);
pane = nwpane;
}
if (value.meta == "za.co.abacus.C_EVENT")
{
app = new Appointment();
}
int atomLen = value.atom.Length;
for (int j = 0; j < atomLen; j++)
{
ViewerService.atom atm = value.atom[j];
if (atm.meta.Contains("za.co.reactor.A_LABEL"))
{
RadPanelItem NewItem = new RadPanelItem(atm.content);
pane.Items.Add(NewItem);
if (app != null)
{
app.Subject = atm.content;
app.Description = atm.content;
app.ID = value.key;
}
}
if (app != null && atm.meta.Contains("za.co.abacus.C_EVENT"))
{
app.ID = atm.content;
}
if (app != null && atm.meta.Contains("za.co.reactor.A_HORIZON"))
{
app.Start = Convert.ToDateTime(atm.content);
}
if (app != null && atm.meta.Contains("za.co.reactor.AA_HORIZON"))
{
app.End = Convert.ToDateTime(atm.content);
}
if (app != null && atm.meta.Contains("za.co.reactor.A_TEXT"))
{
app.Description = atm.content;
}
if (app != null && app.End > app.Start)
{
RadScheduler1.DataStartField = app.Start.ToString();
RadScheduler1.DataSubjectField = app.Subject.ToString();
RadScheduler1.DataEndField = app.ToString();
RadScheduler1.DataKeyField = app.ID.ToString();
RadScheduler1.SelectedView = SchedulerViewType.MonthView;
RadScheduler1.SelectedDate = app.Start;
RadScheduler1.Visible = true;
}
}
}
}
}
catch (ApplicationException ex)
{
}
finally
{
obj.closeSession(SessionKey);
}
}
Now this Function works well and it has no problems , in the debug more, i check the value that is supplied to this function from the page method function its fine. and my JS looks like this
function keyPress() {
var tb = document.getElementById("<%=txtsearchid%>");
if (tb.value.length == 2) {
PageMethods.Getadata(tb.value);
ToggleCollapsePane();
}
return false;
}
and the Toggle function
function ToggleCollapsePane() {
var splitter = $find("RadSplitter1");
var pane = splitter.getPaneById("LeftPane");
if (!pane) return;
if (pane.get_collapsed()) {
pane.expand();
}
else {
pane.collapse();
}
}
so the Getadata() Function will call the Bind_SearchBox() Function and pass the Parameter and the function Bind_SearchBox() will do the Job as you can see at the end it sets some control to visible. But this does not bring me back results(The RadScheduler1 is not binded with data and RadPanelBar1 does not show anything)
I had a search button that is that was calling the same method and passing the same parameters but it could show results and it looked like this
protected void btnSearch_Click(object sender, EventArgs e)
{
RadToolBarItem textItem = RadToolBar1.FindItemByText("Button1");
TextBox txtseach = (TextBox)textItem.FindControl("txtsearch");
if (txtseach.Text != "")
{
Bind_SearchBox(txtseach.Text.Trim());
}
}
In FireFox i get this Error when i debug it
<br />
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'Getadata' failed with the following error: System.NullReferenceException-- Object reference not set to an instance of an object.
If i click this above button it will show results. The txtseach have the same text and it calls the same method but when i call this function and inject parameters from page method it does not work.
I am Surprised.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
modified on Tuesday, August 10, 2010 7:05 AM
|
|
|
|
|
First of all this is the question for ASP.NET forum.
Second: it's no surprise that it doesn't work really. What you're trying to do must be accomplished with a postback. You can call your Bind_SearchBox from JavaScript, but Bind_SearchBox will have no way to return its results to the browser. Solution for your problem is to execute postback instead of calling pagemethod. I don't remember parameters exactly, but you have to supply it with id of control, that triggers postback (in your problem this would be a search button). Or maybe you should reconsider your solution and trigger the Bind_SearchBox from additional postback.
I hope, that what I written is more less clear. If not, please ask
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Good Day
I have updated the Post.at the bottom there is an Error that comes back if i debug with Firefox
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'Getadata' failed with the following error: System.NullReferenceException-- Object reference not set to an instance of an object.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
And did you debug the Bind_SearchBox method when you call it from your javascript? Exception must come from somewhere.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Yes i have debugged it and i realized that when i enter the Function , when it goes to this two lines
RadPanelBar1.Items.Clear();
RadScheduler1.Appointments.Clear();
and this one
RadPanelItem pane = RadPanelBar1.Items.FindItemByText(PanelClass);
it goes to the finally block and exit the loop. in IE the debug gives me nothing but in Firefox after the Finally then i get the error i sent you.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
The reason exception is thrown is that the View you create doesn't go the regular page lifecycle (I assume the View is your ascx/aspx). Youd didn't call Init, Load or DataBind or whatever event you're filling your controls with data in.
As I said. Try redesign your solution, so it uses postback. Tell me, why you're using javascript and maybe I'll be able to give you a hint.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Good Day
You are Right the View is the Class name of the page aspx and i used javascript because i wanted to handle the keyPress event of the textbox
function keyPress() {
var tb = document.getElementById("<%=txtsearchid%>");
if (tb.value.length == 2) {
PageMethods.Getadata(tb.value, myFunction(tb.value));
ToggleCollapsePane();
}
return false;
}
and take the value that has been entered on key-press and execute the function.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
modified on Tuesday, August 10, 2010 10:15 AM
|
|
|
|
|
OK, so look at the HTML generated by your site. The textbox, that you have you event attached to should have its change event set. (I assume, the textbox you're fighting with right now is the same.) Set the same value for the keyPress event of the textbox and it should work.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Yes the Textbox is the same.
<br />
Set the same value for the keyPress event of the textbox and it should work.
can my give me an example
Thank you for your help
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
OK. At last I have Visual Studio to prepare an answer
<asp:TextBox runat="server" ID="text" OnTextChanged="Bind_SearchBox" onkeyup="this.onchange();" AutoPostBack="true" />
AutoPostBack="true" is required for this to work.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Good Day
Thank you for your kind reply.
i have changed my textbox from this
<asp:TextBox ID="txtsearch" runat="server" Font-Size="X-Large" onkeypress="keyPress()" Height="40px"
Width="650px"></asp:TextBox>
to this
<asp:TextBox runat="server" ID="txtsearch" OnTextChanged="Bind_SearchBox" Font-Size="X-Large" Height="40px" Width="650px" onkeyup="this.onchange();" AutoPostBack="true" />
and i get an Error that says
Error 4 No overload for 'Bind_SearchBox' matches delegate 'System.EventHandler' C:\Pilot Project\View.aspx 99
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Yeah, my mistake. Add method
protected void Bind_SearchBox(object sender, EventArgs e)
{
if(sender.Equals(txtsearch))
{
Bind_SearchBox(txtsearch.Text);
}
}
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
You know what ?
You are a Star , it works very nicely , i just need to add ajax to remove the flickering of the page.
Thanks my friend
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi
I'm running couple of SQL Server instances in two different instances, Instance A is the master which replicates the data to Instance B. Im running Transaction Based replication, which working well.
Now I want to route the WRITE (Insert, Update, Delete) calls from my ASP.Net application to Instance A and READ (Select) calls to Instance B?
Is there any load balancing mechanism available to do this?
Thanks
|
|
|
|
|
C# forum is probably not the correct place for this, I doubt if the database forum will be any better but I would try there. You may be better served by using a dedicated database site - SQLServerCentral.com comes to mind. This really is a DBA type question (rather than a developer question).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
satsumatable wrote: Now I want to route the WRITE (Insert, Update, Delete) calls from my ASP.Net application to Instance A and READ (Select) calls to Instance B?
Have you tried anything?
The databases only have replication running between them right? So that means that the two databases are distinct entities that can be connected to using separate connection strings. If your application has a dedicated DAL, all the change you need to make is have two separate methods that open a connection, something like
OpenConnectionForWrite()
OpenConnectionForRead()
and your code can call the appropriate method depending on whether it's reading or writing.
SG
Aham Brahmasmi!
|
|
|
|
|
I m planning to develop a payment gateway Application.
Do any body have some tutorials or sites where i can get some good exposure to Payment gate way development
Thanks in advance
|
|
|
|
|
I would like to know how often you all build and run a project during development. As far back as I can remember, when I first started programming (C++ with the Dev-C++ IDE) I find myself building/running a project quite often. Usually every time I add something new or fix a problem in the code.
Is there some sort of general practice for how often you should do this? Or does that not matter? BTW, I am referring to developing on a single machine. I don't have any experience in a team environment and I have never used any kind of source control.
|
|
|
|
|
Build early, build often.
|
|
|
|
|
Thanks. That's what I figured but I had a bit of doubt at first, thinking something is wrong if you must build quite often. :-P
|
|
|
|
|
I build all the time. When I add 10 lines of code, I build, run, test and fix. When I change a few lines, ditto. I make sure my project can always be built, and all new/modified code gets tested right away.
|
|
|
|
|
I used to build the component that I work and it's dependencies frequently. But I usually won't build the whole application all the time as it takes more time. On the current project we have a continuous integration server available which will build the whole project once the code is checked in.
Build architecture for C++ projects and C# projects are different. C++ uses incremental approach and only those files that are modified gets compiled. This is a huge time saver after the initial compile. In .NET (except C++/CLI), this is handled at the project level. So if any of the files got modified in the project, VS will compile the whole project rather than just one file. So improper project organization will lead into longer build time.
Best wishes,
Navaneeth
|
|
|
|