|
what are u talking about? its not clear...
USER Controls are used to make abstraction in a complex logic. the dot net architecture suggests that if one needs to pass some value to UC (user control) and then there is something to be processed in UC and after some event the user needs some value to be read form the UC......the only way is :->
create user control UC
->
declare a public property named INPUTVAL for getting input
->
declare another proerty named OUTPUTVAl for producing some output/operation of filling dropdownlist
->
define a method for processing something named as BINDUC()
->
use the UC on an .aspx page
->
pass the projectID as ....... UC1.INPUTVAL= dropdownlist1.selectedValue // may be from anything else
->
now the processing in the UC will take place...RIGHT in ur case...... so call the method
->
UC1.BINDUC()
->
Read the value from UC in the variable on .aspx page
->
projectIDUC=UC1.OUTPUTVAl
its over !
hope it will help...
Ashish Sehajpal
|
|
|
|
|
Your core issue as far as I can see, is that you are setting your property in page load, which is too early. Trying to do it in the prerender event may solve your issue, but I still don't get why a user control is needed to change a setting on the aspx
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm sorry I don't explain myself so good (my english is not SO good)...
For me it is simple - I have a usercontrol.....
Normally i would do this.......
<crm:SetProject runat="server" id="SetProject" ProjectId="500" />
on an aspx page to load the usercontrol with the parameter ProjectId = 500 - I then in the user control can use the 500 to do something with this.....
My problem is - when I do it this way - the parameter will always be 500 - And I don't know what the parameter is at page load time....... I first know what the parameter is when I hit a button on the page........
So when I hit the button - I need to make an instans of the usercontrol with the parameter ProjectId="9999"
|
|
|
|
|
simsen wrote: So when I hit the button - I need to make an instans of the usercontrol with the parameter ProjectId="9999"
So, you set it in code when you create the control. ProjectId must be a public property, or it would not be available from the aspx. Why can't you just set it in code ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Now we are getting to my problem........
I don't know how to set it when I create the control..... I tried many things but each time it sais - it dosn't know the SetProject.ProjectId....
I use these to lines to create the control from codebehind....
Control setproject = (Control)LoadControl("~/UserControls/TestSetProject.ascx");
phNewProjectEdit.Controls.Add(setproject);
But when I then try to make a
setproject.ProjectId
the system cannot find the ProjectId - the error sais something like this:
System.Web.UI.Control doesn't contain a definition of 'ProjectId'
|
|
|
|
|
simsen wrote: Control setproject = (Control)LoadControl("~/UserControls/TestSetProject.ascx"); phNewProjectEdit.Controls.Add(setproject);
There is your problem. The Control class does not contain this property. You need to cast to the type of your specific control, to be able to access the properties that exist in your control and not the base class.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I don't understand that you say that the control doesn't contain this property.....
If you see the ascx.cs you can se I have made a public property?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class UserControls_TestSetProject : System.Web.UI.UserControl
{
private string _ProjectId = "";
public string ProjectId
{
get { return _ProjectId; }
set { _ProjectId = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
lblEditProjectNameHeadline.Text = ProjectId;
}
}
|
|
|
|
|
You should buy a book on OO and read it then.
You are creating an instance of your control, but your local reference, is a reference to a base class. It therefore does not know that the class instance is a specific derived class, it could be any class derived from Control. Until you cast it up to the class thhat contains that property, it will not be visible.
If you do this:
((UserControls_TestSetProject )myControl).ProjectId = "Blah";
it will work, assuming your variable is called myControl. For the reasons I have explained.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you very very much...... It was what I needed...... Now I only have to figure out, how I get it without to have to push the button twice (I know it's becauce of the page_load comes before the btnPush_Click and I have to make an instans of the user control each time I load the page)
I wil use some times of this problem before I get back to this forum for help....
But again thank you very much for your help. It helped me very much
|
|
|
|
|
simsen wrote: I know it's becauce of the page_load comes before the btnPush_Click and I have to make an instans of the user control each time I load the page)
Like I said, call it in the prerender event instead, it comes after the button clicks
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You aren't setting the ProjectId property on the control when you create it. Try moving everything to the button's click event, like this:
protected void btnPush_Click(object sender, EventArgs e)
{
UserControls.TestSetProject setproject = (UserControls.TestSetProject)LoadControl("~/UserControls/TestSetProject.ascx");
setproject.ProjectId = "15855"
phNewProjectEdit.Controls.Add(setproject);
}
Broken Bokken
http://www.brokenbokken.com
|
|
|
|
|
Hi Josh
When I try this, an then click on a button that is in the user control the control disappear... How can I get the user control to appear again (I have to get the user control from it self)
|
|
|
|
|
i have menu control which contains three root nodes
admin
--page1
--page2
--page3
transaction
--page4
--page5
--page6
reports
--page7
--page8
--page9
i want to use the sitemappath control
but in the site map path , i can add one root node thus it creates one root node only.How should i avoid this problem.
I mean when i click the page 4 , then the sitemap should show
Home > Transaction > page4
But xml file does not allow more then one root node.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
You need to add a root node named "Home". Then it will show Home > Transaction > page4 if you are in page4
|
|
|
|
|
very right approach..
cheers !
Ashish Sehajpal
|
|
|
|
|
Thanks
|
|
|
|
|
Dear Friends,
I want information about ASP.Net page, when any ASP page created the control on each page should have any unique identity so i can use that id, i found the unique number and id of control Text Box but i found it not unique because every time i check the number randomely it give me new number i think its browser specific (code given below)
mshtml.IHTMLUniqueName uInputName = (mshtml.IHTMLUniqueName)MyContorl.DomElement;<br />
messageBox.show(uInputName.uniqueID);<br />
messageBox.show(uInputName.uniqueNumber.ToString());
is there any other uniquness in control, or my assumption is wrong.
Please clear me thanks in advance.
Sasmi
|
|
|
|
|
Hai all,
I have to develope one resume filtering application.I have resume is there in one of my folder.i just want to filter the resume acording to the content of that resume.For example in my search feild i give the phone number "234567" i want to retrieve all resumes which contain this phone number.I dont have any idea abt this.Can anyone give me some idea how to do it?
Thanks in advance.
With Regards
Lijo
|
|
|
|
|
If you have no idea why have you been giving the task?
Where are the resumes? in a database?
I think you need to give us more information or at least search google and then once youve got some where post again
|
|
|
|
|
Resume is not in database. It is in one folder.by using stream writer i will write it to one word pad which is in that folder.by using stream reader i can read that also.
but according to the content of resume i need to filter it...
|
|
|
|
|
To search a text with in a text i think you have to read all the text from file in memory and than use the string function to find the substring with in the string.
|
|
|
|
|
Lijo Rajan wrote: I have to develope
Lijo Rajan wrote: I dont have any idea
This is why outsourcing sucks.
You can control Word through the tools for Office. You cannot just read a word file as a stream, unless it's the new file format, then it's a zip, full of XML, you can probably search that with a bit of work.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how should i invoke the mail message window (new message window) of outlook express in asp.net
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Well, did you try google ? You can't explicitly launch outlook express, you can only use a mailto: link to open the default mail program.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how should i write the code to invoke only the new message window .
as u said to use mailto , how should i use it?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|