|
Mr Apurva Kaushal who resopnded for my last days doubt,
Here for the first time when i select a state that will not display.Same happening in DIvision also.If i select second time all are working properly.so wat to do for this??? a
and i have a code like
Dim cnt As Integer
cmdcnt = New SqlCommand(" Select MAX(Centre_Id) from Division_District where District_Id='" & num & "'", dbConn)
cnt = cmdcnt.ExecuteScalar()
If cnt = 0 Then
cnt = 1
if max is null the nhow to compare that value with ordinary integer.Like Isdbnull() or something.
kissy
kissy
|
|
|
|
|
Kissy16 wrote: Here for the first time when i select a state that will not display.Same happening in DIvision also.If i select second time all are working properly.so wat to do for this??
I don't see any reason why it will not work for the first time. Is the page is getting posted back or simply nothing is happening.
Kissy16 wrote: Dim cnt As Integer
cmdcnt = New SqlCommand(" Select MAX(Centre_Id) from Division_District where District_Id='" & num & "'", dbConn)
cnt = cmdcnt.ExecuteScalar()
If cnt = 0 Then
cnt = 1
ExecuteScalar executes the query and return one value.
Here you can do like this:
cmdcnt = New SqlCommand(" Select MAX(Centre_Id) from Division_District where District_Id='" & num & "'", dbConn)
Dim r As SqlDataReader = cmdcnt.ExecuteScalar()
if(!sqlDataReader.IsDbNull(columnIndex))
Then do the operations here
endif
Best Regards,
Apurva Kaushal
|
|
|
|
|
It doesnt display anything in any other two lists when i clicked on list1,and samething happend if select list2,list3.
If i attempted 2nd time all are working properly.
all the settings are correct.but not working for the first time.
I think the first statement in my selectedchanged event is "list.Items.clear()".Am i correct.For the secondtime it will work but for first time also it clears the list,Isn't it?
wat to do.
-- modified at 6:47 Wednesday 30th August, 2006
kissy
|
|
|
|
|
It doesnt display anything in any other two lists when i clicked on list1,and samething happend if select list2,list3.
If i attempted 2nd time all are working properly.
all the settings are correct.but not working for the first time.
I think the first statement in my selectedchanged event is "list.Items.clear()".Am i correct.For the secondtime it will work but for first time also it clears the list,Isn't it?
wat to do.
kissy
|
|
|
|
|
Kissy16 wrote: t doesnt display anything in any other two lists when i clicked on list1
You have change something in the itemlist to get the event fired.
Kissy16 wrote: think the first statement in my selectedchanged event is "list.Items.clear()"
In your case this is required.
Kissy16 wrote: the secondtime it will work but for first time also it clears the list,Isn't it?
Why is it clearing the list as it will get executed only when you are changing something in the previous control, and in that case it is correct as it is clearing it and again filling it with the new data.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
I am using a DataList control, and have a checkbox in it.
There is also a button whihc performs a certain action on the basis of which all check boxes are checked.
Now i want to validate on the click of the button that if no check box is checked then it should not do anything.
How can it be possible with JavaScript. (Client Side validation)
I basically want no postback to happen so that unnecessary server trip is avoided.
Thanks in advance.
Deepak Surana
|
|
|
|
|
What you need to do in javascript is to check the checkboxes whether they are checked or not.
Like this:
if(CheckBox1.checked)<br />
{<br />
alert("checked");<br />
}<br />
else<br />
{<br />
alert("not checked");<br />
}
Best Regards,
Apurva Kaushal
|
|
|
|
|
This can work if there is only one check box, but i have a list of checkboxes..
|
|
|
|
|
In this case what you can do is to take a boolean value and iterate through all the checkboxes and if you get any checkbox checked then make the boolean value and then later just check the value and do the operation.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Can you please tell me how to write that function and where to call it.
Thanks.
|
|
|
|
|
Hi!
Ive got a problem with debugging my asp.net application. Everytime I start the debugger the studio starts loading files from c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net, and this takes absolute ages, sometimes up to 10 minutes. But if I start debugger again without doing changes in code the loading time is instead a few seconds. Why does this take so long, and is there anything I can do to shorten the time it takes to load the temp files?
/regards Magnus
-- modified at 2:04 Friday 1st September, 2006
|
|
|
|
|
Remove all the temporary files and see.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks for your response Apurva
Sadly I´ve already tried this to no avail. Loading times remains unchanged.
/regards Magnus
|
|
|
|
|
Hi, Magnus.
...maybe your harddisk is broken.
I've had the similar behaviour some time ago (but with another app), and it turned out the harddisk was the problem.
Regards
Jürgen
|
|
|
|
|
thanks, I'll look into it.
/Regards Magnus
|
|
|
|
|
Hi, all.
I'm having a strange problem while writing custom server control.
The control works fine so far, but I wanted to add some features which support the developer while using the control in the Visual Studio designer. Therefore I've added a designer which extends ContainerControlDesigner...
Code fragment:
<br />
public class MyDesigner : ContainerControlDesigner <br />
{<br />
<br />
public override string FrameCaption {<br />
get<br />
{<br />
MyComponent c = (MyComponent)base.Component;<br />
<br />
return "MyComponent - " + c.MyProperty;<br />
}<br />
<br />
}<br />
Problem:
Sometimes the cast MyComponent c = (MyComponent)base.Component will throw an exception - and sometimes not. I haven't found a reason for this. The type of base.Component is MyComponent . I've checked this in the debugger. Even Visual Studio shows me all properties of this type during debugging.
I've modified the code and read the value of c.MyProperty via reflection - and it works...
Any ideas what might be wrong or what happens here?
Any help appreciated.
Regards
Jürgen
Stuttgart
Germany
|
|
|
|
|
Hello Jürgen
Im not sure why you get this error, but propably the type is not right. Use a type safe cast instead and call the base class if the cast is not successful.
public class MyDesigner : ContainerControlDesigner
{
public override string FrameCaption {
get
{
MyComponent c = base.Component as MyComponent;
if (c != null)
return "MyComponent - " + c.MyProperty;
else
return base.FrameCaption;
}
}
Kind Regards,
John Petersen
|
|
|
|
|
Hi, John.
Thanks for your answer.
A typesafe cast will not throw the exception, that's right.
But nevertheless my designer will not work.
And: the type is correct. I even used the full qualified class name to be sure.
When I log a message printing the typename it's ok, too.
Very strange behaviour...
Have you (or somebody else) written a designer which works well?
Regards
Jürgen
|
|
|
|
|
Hello again
I think i know what is wrong. The ContainerControlDesigner is used to create a designer that can contain several controls. Maybe you should derive from CompositeControlDesigner instead?
i found a sample of this here
Kind Regards,
John Petersen
|
|
|
|
|
Hi, John.
Thank you for the link. I've found this already and unfortunately it didn't help me.
I think the ContainerControlDesigner is the right pick.
VS help says: "(ContainerControlDesigner) provides designer functionality for controls that contain child controls or properties that can be modified at design time."
Controls placed on MyComponent are designed by their own designer...
Regards
Jürgen
|
|
|
|
|
Hi there,
+ What exception do you have?
+ Like John said, are you sure that you choose the right base class for your custom designer? Also what does your MyComponent look like?
+ And you may want to verify the type of the component in the method below:
public override void Initialize(IComponent component)
{
base.Initialize(component);
}
|
|
|
|
|
Hi,
I've tried what you mentioned:
<br />
public override void Initialize(IComponent component)<br />
{<br />
base.Initialize(component);<br />
<br />
try<br />
{<br />
MyComponent o = (MyComponent)component;<br />
}<br />
catch (Exception ex)<br />
{<br />
string s = ex.Message;<br />
}<br />
}
- Exception: Unable to cast object of type 'jmse.WebControls.MyComponent' to type 'jmse.WebControls.MyComponent'.
- InnerException is null
- the declaration of MyComponent: public class MyComponent : View, INamingContainer
- I've modified the source but still have the same effect; declaration of the designer: public class MyComponentDesigner : ViewDesigner
- MyComponent is placed on a MultiView
|
|
|
|
|
Below is a quick and simple control that is working in my case:
[ToolboxData("<{0}:MyComponent runat=\"server\"></{0}:MyComponent>"), Designer(typeof(MyDesigner)), ParseChildren(false)]
public class MyComponent : View, INamingContainer
{
public MyComponent()
{
}
private string myVar;
public string MyProperty
{
get { return myVar; }
set { myVar = value; }
}
}
public class MyDesigner : ViewDesigner
{
string error = string.Empty;
public override void Initialize(IComponent component)
{
base.Initialize(component);
try
{
MyComponent o = (MyComponent)component;
}
catch (Exception ex)
{
error = ex.Message;
}
}
public override string FrameCaption
{
get
{
if (!string.IsNullOrEmpty(error))
return error;
MyComponent c = (MyComponent)base.Component;
return "MyComponent - " + c.MyProperty;
}
}
}
A snippet of the ASP.NET markup of the testing web page:
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="1">
<asp:View ID="View1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" Text="dsd"></asp:TextBox></asp:View>
<cc1:MyComponent ID="MyComponent1" runat="server" MyProperty="My Custom View">
<asp:Button id="Button1" runat="server" Text="Pushed Me!" />
</cc1:MyComponent>
</asp:MultiView>
Btw, do you put your component control and its designer in a seperate web control library project or in the same web site project of the application?
|
|
|
|
|
Hi,
thanks again for your help.
I've tried your code and the component works fine.
No errors; all casts are OK.
I've added my component to the same test project and again the error occurs.
What I found out: the error only occurs when the component is added from the toolbox to a WebForm (regardless of added by doubleclick or dragged with the mouse). When the WebForm is closed and opened again in the designer, all of my components are processed without error.
My component and the designer are in an extra WebLibraray project. For debugging I use two instances of VS 2005.
The complete declaration of my component:
[
AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal),
ToolboxData("<{0}:MyComponent runat=\"server\"> </{0}:MyComponent>"),
ToolboxBitmap(typeof(MyComponent), "MyComponent.bmp"),
Designer(typeof(MyComponentDesigner)),
ParseChildren(false),
PersistChildren(true)
]
public class MyComponent: View, INamingContainer
Any idaes?
Regards
Jürgen
-- modified at 4:25 Thursday 31st August, 2006
|
|
|
|
|
Hi there,
+ Do you get the error right after you add the control onto the web page or after you do something and the error occurs?
+ If you manually add the custom component in the source view and switch back to the Design view, do you still get the error?
+ Do you plan to use the MyComponent with the MultiView control?
|
|
|
|