|
|
|
No.
It is like it says it is in every book on C# and in almost every example on CodeProject.
|
|
|
|
|
string[] str= new string[100];
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
hi
I have created one method createdropdown()in that i had create one dynamic dropdownlist and in selectindexchange of that dropdownlist i had created another dynamic dropdownlist and again selectedindexchange of the second dropdown .
but when i run this code it will call first selectedindexchange when i select the dropdownvalue but it want call second selectedindexchange.
i had done autopostBack=true for both the dropdownlist.
Please Help It is some urgent Task that i have to complet.
in the below ddl_SelectedIndexChanged() is call but ddl2____SelectedIndexChanged is not fired.....?
// Add DropDownList Control to Placeholder
private void CreateDropDownBoxes()
{
//int counter= Convert[ViewState ("counter"),Int32];
for (int counter = 0; counter <= NumberOfControls; counter++)
{
DropDownList ddl = new DropDownList();
ddl.ID = "DropDownList_ID" + (counter + 1).ToString();
ddl.AutoPostBack = true;
ddl.AppendDataBoundItems = true;
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
DataTable dt = new DataTable();
dt = getdata_workspace();
ddl.DataSource = dt;
ddl.DataTextField = "displayedname";
ddl.DataValueField = "id";
ddl.DataBind();
phDropDownLists.Controls.Add(ddl);
phDropDownLists.Controls.Add(new LiteralControl("
"));
}
}
public void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
int n = this.NumberOfControls;
for (int i = 0; i < n; i++)
{
SqlConnection conn = new SqlConnection(connStr);
string boxName = "DropDownList_ID" + (i + 1).ToString();
DropDownList ddl2_ = phDropDownLists.FindControl(boxName) as DropDownList;
DropDownList ddl2___ = new DropDownList();
ddl2___.ID = "DropDownList__" + (i + 1).ToString();
ddl2___.AutoPostBack = true;
ddl2___.AppendDataBoundItems = true;
ddl2___.EnableViewState = true;
SqlCommand cmd = new SqlCommand("select * from unit where workspaceid='" + ddl2_.SelectedValue + "'", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
ddl2___.Items.Add(dr.GetString(2));
}
// ddl2___.EnableViewState = true;
ddl2___.SelectedIndexChanged += new EventHandler(ddl2____SelectedIndexChanged);
ddl2___.DataTextField = "displayedname";
ddl2___.DataValueField = "id";
phTextBoxes.Controls.Add(ddl2___);
phTextBoxes.Controls.Add(new LiteralControl("
"));
}
// throw new Exception("The method or operation is not implemented.");
}
void ddl2____SelectedIndexChanged(object sender, EventArgs e)
{
int n = this.NumberOfControls;
for (int i = 0; i < n; i++)
{
SqlConnection conn = new SqlConnection(connStr);
string boxName = "DropDownList__" + (i + 1).ToString();
DropDownList ddl2_ = phTextBoxes.FindControl(boxName) as DropDownList;
DropDownList ddl2___ = new DropDownList();
ddl2___.SelectedIndexChanged += new EventHandler(ddl2____SelectedIndexChanged);
ddl2_.ToolTip = "ddl2";
SqlCommand cmd = new SqlCommand("select * from unitoperation where workspaceid='" + ddl2_.SelectedValue + "'", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
ddl2___.Items.Add(dr.GetString(3));
}
phdropdown3.Controls.Add(ddl2___);
}
}
Please Help ...Help...
|
|
|
|
|
advice 1:do not post whole project in the forum, its irritating, only post the code which u feel as doubtful.
advice 2: ur naming convention according to the above code is very very bad.
(such as ddl___SelectIndex...).
dude:if u wanna quick result for ur problem, follow the advice.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
i just created an addin in VS 2005. The addin uses different dll files and icons and the final product when run i got is the addin file and the dll file. now i want that addin to be used in other machines too and just copying the dll and addin is not just a solution (as it requires other dll and the icons).
can anyone help me out, how to make that possible?
Thanks in advance.
Your life is what your thoughts make it.
|
|
|
|
|
Hi,
I have created a Windows Component class(in C#) which will be used by the other developers in their application during the design time. The developers will add the component into the tool box by adding the reference to it. Later they drag and drop the copmponent on the Windows form.
I needed the component in such a way that the developer could add the collection items into it. So I have inherited the CollectionEditor class in the component.
Am able to add the collection items into the collection editor. But am not getting the added items back when I close the windows application and open it again.ie., it doesn't appear to be assigning the added items to the actuall collection in the form's InitializeComponent() function.
> Can you please suggest me some solution.
"Don't go the way life takes you…... Take the life the way you go……….."
|
|
|
|
|
Hi
Is it possible to prevent accessing a method in derived class? Since "sealed" keyword is only used along with "override" I can not use this option in the base class.
Thanks,
Diana.
|
|
|
|
|
private methods cannot be overridden.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Diana Fernandez wrote: Is it possible to prevent accessing a method in derived class?
Yes. Go with Private Access Modifier.
Regards,
Satips.
|
|
|
|
|
Consider the scenario given below
public class Base
{
protected string _name = null;
public void SetName(string Name)
{
_name = Name;
}
}
public class Derived : Base
{
public void SetName(string Name, bool Condition)
{
if (Condition)
_name = Name + "true";
else
_name = Name + "false";
}
}
How is it possible to prevent accessing the Base class method on the object of derived class? Because base class implementation should not be used on the object of derived class.
|
|
|
|
|
Hello,
in this case you should declare it as virtual und override method.
public class Base
{
protected string _name = null;
protected virtual void SetName(string Name)
{
_name = Name;
}
}
public class Derived : Base
{
protected override void SetName(string Name, bool Condition)
{
if (Condition)
_name = Name + "true";
else
_name = Name + "false";
}
}
All the best
Martin
|
|
|
|
|
That will not compile, the method signatures differ.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Uuupss,
Haven't seen that.
than the 'new' would be best todo I think.
public new void SetName(string Name, bool Condition)
{
if (Condition)
_name = Name + "true";
else
_name = Name + "false";
}
}
All the best,
Martin
|
|
|
|
|
Diana Fernandez wrote: Because base class implementation should not be used on the object of derived class.
It's a feature of OO ( and the whole point of inheritance ) that derived classes DO inherit the base methods. The best you could do is make SetName virtual on the base class, and override it on the derived, so it calls the new method with a default condition, or have it throw an error.
public override SetName(string Name)
{
SetName(name, true);
}
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Or use aggregation instead of inheritance - maybe in combination with an interface.
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Hi All,
The requirement is to create factory class that implements a set of cross-cutting aspect classes and provides configuration to create user defined implementations for them at runtime. The user defined assemblies implement the Command pattern, and are invoked in the order they are configured. This requires using Enterprise library for handling configuration data in an external configuration file.
The factory is a singleton class. It references each aspect by an interface. The factory also defines wrapper class to invoke aspect method calls, and load the assemblies on demand.
Please Provide the necessary code and material.
Thanks,
Ramesh Bhojan
|
|
|
|
|
rameshbhojan wrote: Please Provide the necessary code and material.
OK, this is what's called homework. Your teacher is allowed to say this to you, but when you ask people you don't know, to do your homework for you, it's not really the right approach to take.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Don't Cross Post.
Regards,
Satips.
|
|
|
|
|
Hi friends!!.can you help me work with timer control in the web form......
Hi,Im Razana
|
|
|
|
|
You can't, because the timer runs on the server, and your page runs on the client. You can write a timer in javascript, which will execute on the client.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As CG said timer runs on the server side and the control pages runs on the Client side so please try to implement the Javascript, which will execute on the client.
Here is the Code for the Timer control using Javascript.
Regards,
Satips.
|
|
|
|
|
Thank You Graus and Satips...
Hi,Im Razana
|
|
|
|