Basically I want to call a user control from a master page. However, I need to pass an object (a List of objects to be more specific), to the user control. I'm generating the list of objects in the Page_Load of the master page. Here's the line in my master page that calls the user control.
This user control has a parameter called CalendarItems that accepts the list of items. However, if I try to set this inside of the Page_Load method, my control executes before the Page_Load and throws an exception saying CalendarItems is null. Is there any way around this?
EDIT: I have a drop down list on this page that determines what the list of CalendarItems is so when I populate the CalendarItems list I need to be able to read the selected value from the drop down list.
've recently set up an ASP.net site (not using MVC.net) to use URL Routing (more on the code below) - when using user controls on the site (i.e I've created a "menu" user control to hold menu information) the page_load event for that control will fire twice when URLs have more than one variable passed over.
i.e.
pageName/VAR1 : will only fire the page_load event once.
while
pageName/VAR1/VAR2 : will fire the page_load event twice.
*Multiple extra VARs added on the end will still only fire the page_load event twice*.
Below are the code snippits from the files, the first is the MapPageRoute, located in the Global.asax :
[code]....
Note, that when I'm just hitting the page and it uses the default values for items, the reloads do not happen.
I would like to convert some aspx code in user controls. This would lead me to having a master user control that contains other controls inside.
The contained user controls have datasource with some control parameters that takes the value from a control present in the aspx (now) and that will then moved in the container user control.
which is the best way to handle a scenario like this?
I may be putting this wrong. I have an ASP.NET web page which has a GridView, a CheckBoxList and some buttons and textboxes on it. The CheckBoxList and the GridView get their data from an SQLDataSource.
I would like to turn this Web Page into a User Control (which I think I know how to do with the MSDN information). How would I set up this User Control to use the SQLDataSource from the Web Page it is placed upon?
In the below example i cant get the value of "4" to appear in the rendered page. The output from below compiles and executes just fine but all three of the values shown are "0".
Here's a short snippet: (hopefully I'm formatting this correctly)
I haven't used these in awhile. I was just wondering is it possible to pass values or parameters to a user control from the aspx page. Say you register a control and then use it using something like
i am trying to make a pop-up messsage box, using popupControlExtender. Such extender will be inside a web user control but the target control will be outside the user control instead. Could anyone tell me how i can do it ?
I have one User Control ,which is added in to another user control.My First User control define propwerty to populate user control.It working fine if used in page.But now i have problem ,i have to add this control in to another user control. i have added that as we do to add user control ,but am not able to pass the value to that first control from my page.
I am using the below example code and have a problem where I can't pass the Request.RawUrl value into an object that extends the Control object (class Test below).When I use the line:
the string value "<%= Request.RawUrl %>" is passed to the Target property.I need to get the value of Request.RawUrl passed to the Target Property of my Test control object. Does anyone have any ideas where I am going wrong?Control:
i have a usercontrol called navigationmenu whose data is static but varies with loged in1.empID 2.empType 3 Country my question is how can i cache the data of usercontrol based upon combination of these 3 parameters
In Asp.net Web forms why must a user control be partial? I tried to remove the partial keyword and it says: Missing partial modifier on declaration of type 'test'; another partial declaration of this type exists Where is the other declaration?I am trying to pass a generic type with the user control how can I do that? I can't unless I change the other declaration too. I couldn't find it so I removed the partial keyword.Note: you do have 3 files if your making WebApplication but if your making website you only get 2 files? UserControl.ascx UserControl.ascx.cs so in website where is the other declaration?the reason i want generic is because im making a Grid User Control so i want to pass the type the datasource is going to have.
I need to create a user control which will be loaded according to the selected value of a dropdownlist. The Dropdownlist is not the part of Control. I want to pass the value of selected value of dropdonwlist to my user control and the user control will load according to the Value. For not postback it work fine. But when the page is postback, that is when i select a item form dorpdownlist, the user control is not loaded.
I have a page containing a link to to MS Excel spreadsheet (I am able to assume that Excel is available as this is an intranet page). All works fine until I want to pass a parameter into the spreadsheet.
Normally I would do this with /e but this will not work I am starting Excel through a link.
Any ideas how I would pass the parameters into Excel?
(also - there may be multiple requests for the spreadsheet at any time with differing parameters!!)
Instead of specifying 10 parameters in the URL, is there any good alternative way of passing the parameters? And note the new window has to be a popup.
I used a sub in which need to pass about 15 parameters. How to simplify it? Protected Sub test(ByVal _a As String, ByVal _b As String) //about 15 parameters will pass Dim s As String = "insert into AAA a, b value(" & _a & ", " & _b & ")" End Sub
crystal report has two parameters field, however, i used three method searched, all failed. Error is missing parameter values. sure parameter is passing by query string URL] checked by Label However, do not know why Error is missing parameter values.
Method 1 // First parameter ParameterFieldDefinitions crParameterFieldDefinitions; ParameterFieldDefinition crParameterFieldDefinition; ParameterValues crParameterValues = new ParameterValues(); ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue(); crParameterDiscreteValue.Value = Request.QueryString["ID"]; crParameterFieldDefinitions = objRpt.DataDefinition.ParameterFields; crParameterFieldDefinition = crParameterFieldDefinitions["Cheque_IssueRecord_Secretary_Review_TT_ID"]; crParameterValues = crParameterFieldDefinition.CurrentValues; crParameterValues.Clear(); crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues); // Second parameter ParameterFieldDefinitions crParameterFieldDefinitions2; ParameterFieldDefinition crParameterFieldDefinition2; ParameterValues crParameterValues2 = new ParameterValues(); ParameterDiscreteValue crParameterDiscreteValue2 = new ParameterDiscreteValue(); crParameterDiscreteValue2.Value = Request.QueryString["tCOMDB"]; crParameterFieldDefinitions2 = objRpt.DataDefinition.ParameterFields; crParameterFieldDefinition2 = crParameterFieldDefinitions2["tCOMDB"]; crParameterValues2 = crParameterFieldDefinition2.CurrentValues; crParameterValues2.Clear(); crParameterValues2.Add(crParameterDiscreteValue2); crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2); Method 2 //objRpt.SetParameterValue("Cheque_IssueRecord_Secretary_Review_TT_ID", Request.QueryString["ID"]); //objRpt.SetParameterValue("tCOMDB", Request.QueryString["tCOMDB"]); Method 3 var value = new ParameterDiscreteValue(); value.Value = Request.QueryString["ID"]; objRpt.ParameterFields["Cheque_IssueRecord_Secretary_Review_TT_ID"].CurrentValues.Add(value); var value2 = new ParameterDiscreteValue(); value2.Value = Request.QueryString["tCOMDB"]; objRpt.ParameterFields["tCOMDB"].CurrentValues.Add(value2);
This crystal report database use stored procedure, parameter field is automatically added, after added i removed @ character do not know why parameter missing