|
Hi-
I want to create a container user control which will have two place holders (one on left and one of right). Developers should be able to put this container control on their page and set properties to decide which user controls they want to load (dynamically) in those left and right place holders in the container control. For example, i want to create a container control C1.
Developers can put this C1 on their page like
<C1:C1 ID="ucC1" runat="server" uc1="2L" uc2="1R" uc3="1L">
So basically ucC1 is the container control. uc1 and uc2 and uc3 are other user controls that developers need in those place holders (left and right) inside the container control. And "2L", "1R" and "1L" decide the position of the control. for example "1L" means load that one first in the left place holder, 1R means load that one first in the right place holder, 2L means load that as second control in the left place holder, etc....
Now I was wondering, if there is any better or more efficient way to do this whole thing, or atleast a better way to do this "2L" kinda ordering?? Also, i am using the properties of container control to load other user controls dynamically, is this the best way or there's a better way to do this? Any help would be much appreciated! thanks
|
|
|
|
|
You can have a user control which exposes a Dictionary property. There, key can be a placeholder ID. And the value will be control's name. Then, in the set block of the property, you can add the mentioned user control in the container control.
Or, you can have a property each for each PlaceHolder and in its set block, load the mentioned control.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I think you are not looking for User Control... Rather you are asking for Custom Control.
There are two ways to do this, either you create the whole control yourself by deriving from INamingContainer interface, which requires lots of efforts or inherit from an existing control.
I think your requirement needs a completely new control to be created.
Just create a class, derive from INamingContainer, place ParseChildren attribute to all the template children etc.
This might come handy for you :
http://msdn.microsoft.com/en-us/library/aa719862(VS.71).aspx[^]
I hope you are now in right path.
|
|
|
|
|
How can i get the text value of a textbox inside the gridview into a string
|
|
|
|
|
What do you mean by
rakeshs312 wrote: How can i get the text value of a textbox inside the gridview into a string
Can you explain more your case?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Hi,
I have a gridview Gdv1 and inside that i have a TextBox txtname
i want to retrieve the value inside the textbox into a string
Thanks
|
|
|
|
|
TextBox is inside TemplateField?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
|
|
Navigate to the row containing TextBox.
then, get the string value like:
string str = ((TextBox)Row.FindControl("txtName")).Text;
|
|
|
|
|
TextBox txt2 = new TextBox();
txt2 = (TextBox)GridViewName.Rows[2].FindControl("textboxname");
string a = txt2.Text;
not working
|
|
|
|
|
Use RowDataBound event of Gridview to find the context item.
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
TextBox tb = e.Row..FindControl("textboxname") as TextBox;
}
}
|
|
|
|
|
Hi All,
how to launch an application [say notepad] installed in the client system on button click,..using asp.net?
please respond soon.
Thanks
|
|
|
|
|
Why do you want to launch an application on the client machine from the server? This can be done using client scripting, but has very high security risk and will not work if javascript/activex is disabled.
|
|
|
|
|
Hi Dinesh,
Thanks for ur reply. How can it be done?
|
|
|
|
|
I don't exactly remember how to do it, but you need to create activeXobject for the client machine's shell and use the run command on the object to launch the intended application. This would work only on intranet applications where the browser security level allows the browser to access the client machines' shell.
I think this is the code, but not sure, please test and modify -
w = new ActiveXObject("WScript.Shell");
w.run('notepad.exe');
|
|
|
|
|
Ok, thanks dude. i will try with this info.
|
|
|
|
|
But let me remind you..
Shell commands are only available to IE... and also if it has given previledge.
It will not work in any other browser..
So I recommend you to use a custom popup div in your page to show whatever you want to show, rather than opening notepad.
Also let me know if your have some specific requirement around this ..
|
|
|
|
|
one more clarification,, how about using this?
System.Diagnostics.Process.Start("Notepad.exe")
|
|
|
|
|
This runs on the server and starts notepad on the server. This again has high security risks!
|
|
|
|
|
Hi firends,
i am new prog in .net.
How to count online user in asp 2.0...
plz give me solution....
Thanks in advance.
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Increment the Global Static variable / database field during Session Start and Decrement during Session End.
Or you may use Login / Logout as well(but there is no surety of logout).
|
|
|
|
|
ya i am increment global value. but its showing some error..
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Yaa... Application could be used as Global variable.
|
|
|
|
|
ya.. i got it...
but how we can set session time???
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|