Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Monday, March 26, 2012

Mutiple update panel - How to bind trigger event for control which is inside of other upda

Hi,

Thanks for visitng my problem.

I have 3 update panels. in first update panel U1 I have text box T1 and drop dwonbox D1.In second update panel U2 i have only drop down box D2. and in third update panel U3 i have a treeview T1.

I want that When I change selection of D1 in U1, it triiger events for D2 in U2 and T1 in U3. But when I try to bid U2 with D1 change event it does not show show D1 namein triiger control names. Rather it shows U1 panel name. Sam case is for T1 in U3. So my qiestion is : "HOW TO BIND TRIGGER WITH CONTROL WHICH IS INSIDE OF OTHER UPDATE PANEL?"

Looking for your Help.

Thanks,

John

Hi John,

I think the easiest solution would be to place one UpdatePanel around all three controls. If this doesn't work for you, perhaps you could post asmall code sample showing what you already tried.

Thanks,
Ted

My extender control wires its events, then seems to forget what it is!

I've created an extender using the Ajax Extender Control Template. It takes a TextBox as its TargetControl and adds a couple of drop downs to its child controls. Then it responds to the onblur event of the text box. It is supposed to set the values of the drop downs before it posts back. The problem is that when the text box fires its 'blur' event I can't use the 'this' keyword to refer to any of the classes properties or methods. Here is a brief snippett:

Company.Web.MASW.ProductAutoCompleteBehavior.prototype = { initialize : function() { Company.Web.MASW.ProductAutoCompleteBehavior.callBaseMethod(this,'initialize'); $addHandler(this.get_element(),'blur',this._elementChanged ); $addHandler(this._DiameterElement,'click',this._setElementValue ); $addHandler(this._TypeElement,'click',this._setElementValue ); },... _elementChanged : function(e) { alert(this.get_element()); }, _setElementValue : function(e) { alert( this._DiameterElement ); }}
 

The alert commands just verify that I've managed to make the connection to the right input element. It should pop up and say [object] but I get a script error saying object does not support this property or method. I just can't understand how it's calling the right event but can't see it's own properties. Could It be that it's inheriting from the AjaxToolkit.BehaviorBase class?

It seems as though I have a lot to learn about how to connect everything in Ajax. I've done a fair amout of JavaScript and I've done a fair amount of JScript in ASP. I have got a lot to learn about how Ajax connects ECMA, EMCA, E=MC2, or what ever it's called. I just can't fool with it much more for now so consider this 'resolved'. Thanks to all those who read this and said "what in the world is he up to?"

Saturday, March 24, 2012

My only AJAXified page is flashing when it loads

AJAX Programmers,
I have finally deployed a cascading drop down control from the ajax control tool kit to my live site. Right now it is the only ajax control on my newly ajaxified site, but I can't help but notice that this is the only page that flashes when it loads. Seewww.legislature.mi.gov/mileg.aspx?page=SponsorSearch for an example of this. Does this seem normal to you who are experience ajax programmers? I'm getting ready to apply some other ajax contols, but I fear those persons overseeing this site may frown upon this flashing effect. Does it seem like I may be doing something wrong?
Thanks,
Jenny

If you could post some of the code for the page it might help in identifying if there is some change that needs to take place or if it is an issue with AJAX.NET

What seems to be happening is that the flash occurs because the background is loaded first and then the page content vice on your other pages the content will get loaded and then the background will get populated.


I've seen your drop down control and it seems fine.
The control disables when it's data is being refreshed and this is what makes
the "flashing" effect. The page itself, however, is not reloaded.

If you want to assure your customers you may display your page with Firefox using FireBug
extension. The firebug console clears itself whenever the page is being replaced or reloaded
and you can tel for sure that the page does not refresh.

Need code for Drag and Drop Div ...

Hello All...

i have two tables where i have 3 div in 1 one table and 3 Divs in other table.

i want that i can drag any DIV of 1st tables DIV to 2nd TABLES Div and can paste on it..

i went to several solutions but they are providing solutions for HardCord Named DIVS not for Runtime Created DIVs.

pls help me...

It shouldn't work any differently. You just need to assign IDs to the divs when you create them and then assign the behaviors to those IDs. Perhaps if you post the code you are using to create the divs as well as what solution you want to use (I personally like the prototypes at http://script.aculo.us).


Yes. Check these sample for clues

http://www.codeproject.com/aspnet/DragAndDropShopping.asp

http://elouai.com/javascript-drag-and-drop.php

HTH,
Suprotim Agarwal

--
http://www.dotnetcurry.com
--


i am basically creatingDIV dynamically through CODE and i want to paste them on each other

i am not getting any help from http://script.aculo.us site and other answers of my post forums

How can i assign values & Ids of different DIV created at runtime in my JavaScript ?? can u give me a sample code ...

Thank You


var parent = document.getElementById('parentDiv');
var newdiv = document.createElement('div');
var divID = 'myNewDiv;
newdiv.setAttribute('id',divID);
newdiv.innerHTML = 'Element has been added!';
parent.appendChild(newdiv);


http://www.dhtmlgoodies.com/index.html?page=dragDrop

Wednesday, March 21, 2012

need help for vb populate drop down

Hello,

making progress in trying to get atlas working...But not quite there yet...

To populate the dropdownlists from a database:

Public Function populateProjectDDL()
Dim knownCategoryValues As String
Dim category As String
(...)
(Filled my dataset called ds1.)

For Each datarowitem As DataRow In ds1.Tables(0).Rows
?!?!?!?!

Next

return ?!?!?!
end function

What do I return, how do i fill the whatever i return?

(http://atlas.asp.net/atlastoolkit/Walkthrough/CCDWithDB.aspx[^]
was trying to follow that example but they lost me in the c++)

Please help me?

Made more progress, but [method error 500] in the first drop down list...

Here is my code so far:

File "Webservice.asmx":

<%@.WebServiceLanguage="VB"Class="WebService" %>

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports AtlasControlToolkit

Imports System.Collections.Generic

Namespace Wells_KM_System

<WebService(Namespace:="http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

PublicClass WebService

Inherits System.Web.Services.WebService

Protected ds1As DataSet

Protected dbComponent1AsNew DataBase

<WebMethod()> _

PublicFunction populateProjectDDL(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue()

'Dim knownCategoryValues As String

'Dim category As String

'Which projects to show:

If Session("admin") = 1Then

ds1 = dbComponent1.selectOneCondition("Project","active", 1)

'info1.InnerText = "As admin, you see inactive projects, wells, sections and Drilling units as well."

Else

Dim querystr ="SELECT DISTINCT P.project_id, P.project_name FROM Project as P, UserRole as UR WHERE "

querystr = querystr +"UR.user_id = " & Session("active_user") &" AND "

querystr = querystr +"UR.project_id = P.project_id AND "

querystr = querystr +"P.active = 1"

ds1 = dbComponent1.query(querystr)

EndIf

Dim objTableAs System.Data.DataTable

objTable = ds1.Tables(0)

If ds1.Tables(0).Rows.Count > 0Then'user can set defaults

With objTable

Dim intRowAsInteger

Dim valuesAs List(Of CascadingDropDownNameValue) =New List(Of CascadingDropDownNameValue)

For intRow = 0To .Rows.Count - 1

values.Add(New CascadingDropDownNameValue(.Rows(intRow).Item("project_name").ToString, .Rows(intRow).Item("project_id")))

Next

Return values.ToArray

EndWith

ReturnNew CascadingDropDownNameValue() {}

'Return knownCategoryValues

'Return category

Else

ReturnNothing

EndIf

ds1.Clear()

EndFunction

EndClass

EndNamespace

And the aspx file with the drop downs:

<%@.PageLanguage="VB"AutoEventWireup="false"CodeFile="MyDefaults.aspx.vb"Inherits="Wells_KM_System.Personal_MyDefaults" %>

<%@.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlasToolkit" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Set my defaults</title>

<METAhttp-equiv="Content-Type"content="text/html; charset=windows-1252">

<metacontent="Microsoft Visual Studio .NET 7.1"name="GENERATOR">

<metacontent="Visual Basic .NET 7.1"name="CODE_LANGUAGE">

<metacontent="JavaScript"name="vs_defaultClientScript">

<metacontent="http://schemas.microsoft.com/intellisense/ie5"name="vs_targetSchema">

<LINKhref="../Wells_KM_System_Styles.css"type="text/css"rel="stylesheet">

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:LabelID="Label1"runat="server"CssClass="label"Style="z-index: 100; left: 35px;

position: absolute; top: 156px"Text="Select your default well:"></asp:Label>

<asp:LabelID="Label2"runat="server"CssClass="label"Style="z-index: 101; left: 33px;

position: absolute; top: 96px"Text="Select your default project:"></asp:Label>

<asp:LabelID="Label3"runat="server"CssClass="heading"Style="z-index: 102; left: 35px;

position: absolute; top: 24px"Text="Set your default values:"></asp:Label>

<asp:LabelID="Label4"runat="server"CssClass="label"Height="6px"Style="z-index: 103;

left: 35px; position: absolute; top: 214px"Text="Select your default section:"

Width="161px"></asp:Label>

<asp:LabelID="Label5"runat="server"CssClass="label"Height="1px"Style="z-index: 104;

left: 36px; position: absolute; top: 273px"Text="Select your default drilling unit:"

Width="178px">

</asp:Label>

<asp:DropDownListID="projectDDL"runat="server"CssClass="label"Style="z-index: 105;

left: 281px; position: absolute; top: 92px"AutoPostBack="True"TabIndex="1">

</asp:DropDownList>

<asp:DropDownListID="wellDDL"runat="server"CssClass="label"Style="z-index: 106;

left: 281px; position: absolute; top: 154px"AutoPostBack="True"TabIndex="2">

</asp:DropDownList>

<asp:DropDownListID="sectionDDL"runat="server"CssClass="label"Style="z-index: 107;

left: 281px; position: absolute; top: 214px"TabIndex="3">

</asp:DropDownList>

<asp:DropDownListID="drillingunitDDL"runat="server"CssClass="label"Style="z-index: 108;

left: 282px; position: absolute; top: 271px"TabIndex="4">

</asp:DropDownList>

<asp:ButtonID="Save"runat="server"CssClass="button"Style="z-index: 109; left: 34px;

position: absolute; top: 340px"Text="Save defaults"TabIndex="5"/>

<asp:LabelID="Label6"runat="server"CssClass="normal"Height="3px"Style="z-index: 110;

left: 237px; position: absolute; top: 27px"Text="(These values will be used to automatically set these values when you use the application, but you will still be able to change them)"

Width="325px"></asp:Label>

<divid="info1"runat="server"class="notice"style="display: inline; z-index: 111;

left: 578px; width: 303px; color: red; position: absolute; top: 89px; height: 54px">

</div>

<divid="info2"runat="server"class="notice"style="display: inline; z-index: 112;

left: 178px; width: 200px; color: red; position: absolute; top: 342px; height: 15px">

</div>

<atlas:ScriptManagerid="ScriptManager1"EnablePartialRendering="true"runat="server"></atlas:ScriptManager>

<atlasToolkit:CascadingDropDownID="CascadingDropDown1"

runat="server">

<atlasToolkit:CascadingDropDownProperties

TargetControlID="projectDDL"

Category="Project"

PromptText="Select a project"

ServicePath="WebService.asmx"

ServiceMethod="populateProjectDDL"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="wellDDL"

ParentControlID="projectDDL"

PromptText="Select a well"

ServiceMethod="populateWellDDL"

ServicePath="WebService.asmx"

Category="Well"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="sectionDDL"

ParentControlID="wellDDL"

PromptText="Select a section"

ServiceMethod="populateSectionDDL"

ServicePath="WebService.asmx"

Category="Section"/>

</atlasToolkit:CascadingDropDown>

</div>

</form>

</body>

</html>

(Only trying to populate the first drop down list for now)


Have you seenFAQ#20?

Hi,

thx for reply, but I tried that (read the faq, searched forum, read a lot of posts: that's how I got that far...)

Sometimes it gives me [Method error 12031] as well in the drop down list. And so far, as I wrote, I'm only trying to get the first drop down to populate... Think I should be good once I get one to work.

Now I'm thinking the WebService.asmx file is not even kicking in: put a breakpoint on the line:

PublicFunction populateProjectDDL(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue()

But it never kicks in...

I would be very gratefull if someone manages to spot what goes wrong, I'm really eager to see this working and have been sweating on this for 4 days now...


Ok!

I watched this:

http://forums.asp.net/thread/1305208.aspx

And I noticed he populated the first one with a PageMethod, and a script on the aspx page.

I tried that and it got my first DDL populated!!! (which resulted in a little cry of joy)

Sorry about the double post, but there's no edit button, and I don't want anyone wasting time here when I solved it!

But I have no idea why this was the way to do it... But it worked...

Moving on to the next drop downs...

Microsoft #1 !!! Developpers!Developpers!Developpers! :P


Moving on to the second drop down:

1. With a breakpoint in the asmx file, it seems it's never kicking in either...

2. How would I get the first drop downs selected value (needed for the sql query for second drop down, in vb of course...)

Complete WebService.asmx:

<%@.WebServiceLanguage="VB"Class="WebService" %>

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports AtlasControlToolkit

Imports System.Collections.Generic

Namespace Wells_KM_System

<WebService(Namespace:="http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

PublicClass WebService

Inherits System.Web.Services.WebService

Protected ds1As DataSet

Protected dbComponent1AsNew DataBase

<WebMethod()> _

PrivateFunction populateWellDDL(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As AtlasControlToolkit.CascadingDropDownNameValue()

'populate:

Dim conditionFAsString() = {"project_id","active"}

Dim conditionVAsString() = {projectDDL.SelectedValue, 1}

ds1 = dbComponent1.selectMultipleCondition("Well", conditionF, conditionV)

If ds1.Tables(0).Rows.Count > 0Then

Dim objTableAs System.Data.DataTable

objTable = ds1.Tables(0)

With objTable

Dim intRowAsInteger

Dim valuesAs List(Of CascadingDropDownNameValue) =New List(Of CascadingDropDownNameValue)

For intRow = 0To .Rows.Count - 1

values.Add(New CascadingDropDownNameValue(.Rows(intRow).Item("well_name").ToString, .Rows(intRow).Item("well_id")))

Next

Return values.ToArray

EndWith

ReturnNew CascadingDropDownNameValue() {}

Else

ReturnNothing

EndIf

ds1.Clear()

EndFunction

EndClass

EndNamespace

<%@.WebServiceLanguage="VB"Class="WebService" %>

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports AtlasControlToolkit

Imports System.Collections.Generic

Namespace Wells_KM_System

<WebService(Namespace:="http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

PublicClass WebService

Inherits System.Web.Services.WebService

Protected ds1As DataSet

Protected dbComponent1AsNew DataBase

<WebMethod()> _

PrivateFunction populateWellDDL(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As AtlasControlToolkit.CascadingDropDownNameValue()

'populate:

Dim conditionFAsString() = {"project_id","active"}

Dim conditionVAsString() = {projectDDL.SelectedValue, 1}

ds1 = dbComponent1.selectMultipleCondition("Well", conditionF, conditionV)

If ds1.Tables(0).Rows.Count > 0Then

Dim objTableAs System.Data.DataTable

objTable = ds1.Tables(0)

With objTable

Dim intRowAsInteger

Dim valuesAs List(Of CascadingDropDownNameValue) =New List(Of CascadingDropDownNameValue)

For intRow = 0To .Rows.Count - 1

values.Add(New CascadingDropDownNameValue(.Rows(intRow).Item("well_name").ToString, .Rows(intRow).Item("well_id")))

Next

Return values.ToArray

EndWith

ReturnNew CascadingDropDownNameValue() {}

Else

ReturnNothing

EndIf

ds1.Clear()

EndFunction

EndClass

EndNamespace

----- In the aspx file:

<asp:DropDownListID="projectDDL"runat="server"CssClass="label"Style="z-index: 105;

left: 281px; position: absolute; top: 92px"AutoPostBack="True"TabIndex="1">

</asp:DropDownList>

<asp:DropDownListID="wellDDL"runat="server"CssClass="label"Style="z-index: 106;

left: 281px; position: absolute; top: 154px"AutoPostBack="True"TabIndex="2">

</asp:DropDownList>

<asp:DropDownListID="sectionDDL"runat="server"CssClass="label"Style="z-index: 107;

left: 281px; position: absolute; top: 214px"TabIndex="3">

</asp:DropDownList>

<atlasToolkit:CascadingDropDownID="CascadingDropDown1"runat="server">

<atlasToolkit:CascadingDropDownProperties

TargetControlID="projectDDL"

Category="Project"

PromptText="Select a project"

ServiceMethod="populateProjectDDLPageMethod"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="wellDDL"

ParentControlID="projectDDL"

PromptText="Select a well"

ServiceMethod="populateWellDDL"

ServicePath="WebService.asmx"

Category="Well"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="sectionDDL"

ParentControlID="wellDDL"

PromptText="Select a section"

ServiceMethod="populateSectionDDL"

ServicePath="WebService.asmx"

Category="Section"/>

</atlasToolkit:CascadingDropDown>


1. Check that your web.config allows Atlas to use web services (I think there's a special entry in there).

2. Have a look at the AtlasControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString method as used by CarsService.cs. This method returns the selected value of a CDD and all its parents.


My web.config is good...

And I got it working by putting all the populate drop down lists in the aspx file... Seems to work, but it's ugly; would have been nicer with a asmx file.. What I did feels like a workaround (and i would have liked to use that webservice.asmx to populate similar drop downs threw the rest of my project). The end result is still much better than the entire page with tons of controls blinking, which could make a user think the datagrid was being updated at every drop down selection.

I'll still be checking here just in case someone ever spots what's wrong, or if I find out I'll come post the solution (I'm sure someone will find it useful?)

But for now I have to move on, can't stay stuck on the webservice thing too long.


Ok, last (i hope) noob question:

What's the line to get the selected value with VB?

variable = ?

Or to set it...

? = variable


Hi,

Check outhttp://forums.asp.net/thread/1391360.aspx.

Thanks,
Ted

I had a similar problem this weekend, after changing the source code for CCDs I couldn't get any of them to populate, checked all my web service methods, source code numerous times and everything seemed right. Triple checked I had copied all of the web.config settings from the sample web site, but still no joy. Eventually I spotted a new attribute attached the the web service class in the sample app, copied this to my own project and voila everything works again.

This is what needs to be attached to the class that implements your web methods:

C#
[Microsoft.Web.Script.Services.ScriptService()]

VB.NET
<Microsoft.Web.Script.Services.ScriptService()>

This the definition of my class just to show it in context

[WebService(Namespace =http://virtualrealitycycling.com/)]
[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService()]
publicclassSoftwareService : System.Web.Services.WebService
{

//methods in here

}

need help on drag and drop

Hi Friends!

I need a solution to Drag and Drop functionality --
Actually I am able to move the objects/or lets say containers
but main problem is how I will know which Item is being dragged
or how I will get the ID of item being dragged...

after that I have to save that item to database.

Please see to my problem

EDITED by Longhorn2005

The answer to that question depends a great deal on how you implemented the drag and drop behavior. Generally, though, you would expect that you can register to listen for an 'onDrag' or 'onStartDrag' event, and respond to it by capturing the relevant element, and its id for sending to the server via a webservice call or a pagemethod call or a raw webrequest.