ControlType = "System.Windows.Forms.WindowsFormsApplication1." + "PictureBox1"; System.Reflection.Assembly asm; asm = typeof(Form).Assembly; ControlObject = (System.Windows.Forms.Control)asm.CreateInstance(ControlType); ControlObject.Name
= ControlName; The next code generated following exception for me: ControlObject.Name = ControlName;
NullReferenceException was unhandled Object reference not set to an instance of an object.
View Complete Post
my scenario is this: I want to use the linqDataSource control to bind data to a gridview for it's efficient built-in paging and sorting features *but* I don't want the data to be bound until the user has input various search parameters, so I need to bind the data from a button click event. Also, the search options will be somewhat complex in that there will be several optional search parameters, via various dropdowns and textboxes, so I can't just declaratively/statically setup all the WHERE parameters on the linqDataSource (at least I'm assuming I can't, or that it may result in poor performance if I do and just assign default values like the everything wildcard '%' for the cases the user doesn't use a particular search parameter). Given that brief description, here is an example of what I'm doing, but with only one WHERE parameter for simplicity, the real code will be adding anywhere from 1 to about 12 WHERE parameters depending on how the user sets the search options in the GUI.
the linqDataSource on the aspx page:
<asp:LinqDataSource ID="ldsMain" runat="server"
Select="new (field1, field2, field3, etc..)"
I am trying to persist data in a dynamically populated ListBox in a
user control. Here are the details
I have a user control which contains a a listBox and button. On
Page_Load of user control I am populating the ListBox control with some
values. On Click of button, I am trying to fetch the values which I have
selected in ListBox. Though this seems very simple
and straight forward I am unable to fetch values.
My Page_Load Function
void Page_Load(object sender, EventArgs e)
My Click Function
Protected Void Button1_Click(object sender, EventArgs e)
string strValue = listBox.SelectedValue
I have placed brake point at Page_Load and on click function, I am
seeing that the moment the breakpoin
One major inconvenience of using SQL stored procedures from code is having to match type information. You have to write long wrapper functions around the procedures just to expose the data types. In the .NET Framework, however, the reflection services of the System.Reflection namespace allow you to query rich metadata that describe data types. This article explains how to use reflection in .NET to end your stored procedure nightmares. The author creates four custom classes, including one that generates a SQLCommand object based on the metadata of a method. Using this library, you'll be on your way to automating the generation of stored procedures.
MSDN Magazine August 2002
I need urgent help. (c#coding)
In my base page, I have a dropdownlist control which loads different usercontrols on selectedindexchanged event.
While loading these usercontrols, my page postbacks all the page. I used updatepanel but again same problem.
Is there any way to load controls without postback? I Really need help as soon as possible.
Here is my code:
protected void Page_Init(object sender, EventArgs e)
if (Session["control"] != null)
string c = Session["control"].ToString();
if (c == "1")
iuc = (IlkogretimUC)LoadControl("~/Controls/Ilkogretim.ascx");
dl.SelectedValue = Session["control"].ToString();
else if (c == "2")
luc = (LiseUC)LoadControl("~/Controls/LiseUC.ascx");
dl.SelectedValue = Session["control"].ToString();
else if (c == "3")
youc = (YuksekokulUC)LoadControl("~/Controls/Yuksekokul.ascx");
The title pretty much explains it. Here is what i'm trying to do...
Private Sub LoadGrid_CommentsField(ByVal Row As HtmlTableRow, ByVal BookingNumber As String, ByVal CommentsText As String) Dim Txt As TextBox Dim Cmd As ClickOnceButton.ClickOnceButton
Txt = New TextBox Txt.ID = "txtComment_" & BookingNumber Txt.CssClass = "TFAppControls" Txt.TextMode = TextBoxMode.MultiLine Txt.MaxLength = 500 Txt.Width = New Unit(95, UnitType.Percentage) Txt.Text = CommentsText Row.Cells(cComments).Controls.Add(Txt)
Row.Cells(cComments).InnerHtml &= "<br/>"
Cmd = New ClickOnceButton.ClickOnceButton Cmd.DisableAfterClick = True Cmd.Text = "Save Comments" Cmd.ID = "cmdSaveComments_" & BookingNumber Cmd.CssClass = "TFAppButtons" Cmd.EnableViewState = False Row.Cells(cComments).Controls.Add(Cmd) End Sub
On the line where i try and update the InnerHtml, i get the following error; "Cannot get inner content of because the contents are not literal."
I have a web page that contains an UpdatePanel. In that panel, there is a TabContainer control that has 5 TabPanels, only the first one "Tab 1" will be displayed during initial page load. There is an Add button in "Tab 1", whenever it gets clicked, I will add (show) the next TabPanel (Tab 2, Tab 3, etc., all the way to Tab 5). "Tab 2" thru "Tab 5" contains a Close button that will close (hide) the current tab when clicked.
I'm doing all of these from code behind (dynamically create controls in Page_Init event and re-generate them during postback, track each TabPanel's content in a session variable, etc.), and everything seems to work just fine IF after adding several TabPanels, I remove them in order (i.e. remove Tab 5 first, then Tab 4, Tab 3, etc.). It will NOT work whenever I try to remove a tab in the middle, then I will get all kinds of strange results.
I've attached the sample codes here for reviewing and testing. Any help is greatly appreciated.
==================== demo.aspx page ====================