SEARCH YOUR SOLUTION HERE  

Inline Code problem with user control property

Hi all,

i have a problem, when i try to place a inline tag to pass a variable to a user control property.

I have Dim Section As Integer = 2 as a global variable, and then i have:



Now i am not sure, but i thought i could use the inline tags in .Net, but i am not 100% sure of the syntax, can anyone help me to find out what i am doing wrong

Please Help!

Posted On: Tuesday 27th of November 2012 11:22:55 PM Total Views:  215
View Complete with Replies




Related Messages:

Xml/xslt Parser With "inline Xml"   (61 Views)
My code is below. I know my issue is with the "MapPath" I have tried to using XmlTextReader along with StringReader but I have had no success. Should I make the XML into an object public void Page_Load(Object sender, EventArgs E) { string xml = "TEST"; string xmlPath = Server.MapPath(xml); string xslPath = Server.MapPath("XSL.xsl"); string id = Request.QueryString["id"]; XsltArgumentList args = new XsltArgumentList(); args.AddParam("id", "", id); FileStream fs = new FileStream(xmlPath, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(fs, Encoding.UTF8); XmlTextReader xmlReader = new XmlTextReader(reader); XPathDocument doc = new XPathDocument(xmlReader); XslTransform xslDoc = new XslTransform(); xslDoc.Load(xslPath); xslDoc.Transform(doc, args, Response.Output); reader.Close(); xmlReader.Close(); }
Datagrid inline editing problem   (142 Views)
I have a datagrid for which the columns are populated at runtime. I want to be able to do inline editing with this datagrid. So I added a column with an Edit button, and have coded all the edit/update/cancel methods. I only have one problem. When updating the database, I need the field's ID (the primary key) in order to know which row to update. But when I edit the datagrid the ID field is editable too. I obviously don't want users to be able to change this field. How can I make this field read-only I've attached some of the code and a screenshot of the problem: Code: private void dgResults_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string pid = ((TextBox)e.Item.Cells[1].Controls[0]).Text; string computerID = ((TextBox)e.Item.Cells[2].Controls[0]).Text; string firstName = ((TextBox)e.Item.Cells[3].Controls[0]).Text; string lastName = ((TextBox)e.Item.Cells[4].Controls[0]).Text; string query = "UPDATE CompName SET " + "Computer_ID = '" + computerID + "', " + "FirstName = '" + firstName + "', " + "LastName = '" + lastName + "WHERE ID = @pID"; string connString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; SqlConnection conn = new SqlConnection(connString); conn.Open(); SqlCommand updateCommand = new SqlCommand(query, conn); SqlParameter paramID = new SqlParameter("@pID", pid); updateCommand.Parameters.Add(paramID); try { updateCommand.ExecuteNonQuery(); } catch (Exception ex) { lblResults.Text = "Error: " + ex.Message; } finally { updateCommand.Connection.Close(); lblSearchField.Text = "ID"; lblSearchValue.Text = pid; } dgResults.EditItemIndex = -1; Bind(); } private void Bind() { string myQuery = "SELECT ID, FirstName, LastName FROM CompName WHERE " + lblSearchField.Text + " LIKE '%" + lblSearchValue.Text + "%'"; if (lblSortBy.Text != "") myQuery += " ORDER BY " + lblSortBy.Text; string connString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; try { myDataAdapter = new SqlDataAdapter(myQuery, connString); myDataAdapter.Fill(myDataSet, "CompName"); dgResults.DataSource = myDataSet.Tables["CompName"]; dgResults.DataBind(); } catch (Exception ex) { this.lblResults.Text = "There was an error searching the database. " + ex.Message; } }
question about ~ for inline use in NavigateUrl property   (106 Views)
, You could use the full URL: ''
question about ~ for inline use in NavigateUrl property   (114 Views)
, You could use the full URL: ''
inline coding question from newbie?   (159 Views)
I need to manipulate the width of a table td depending on a Request.QueryString. How would you write out this code using inline coding:
code behind .net inline tag style="border-width:0px;"   (88 Views)
You can set the style attribute or borderwidth attribute in the ascx file even though style doesn't appear in the intellisense it is still picked up when the control is parsed. Alternatively if you want to set it from the .cs file then you can do this: imgProductThumb.BorderWidth = 1; or imgProductThumb.attributes["style"] = "border-width:1px;"; Hope it helps Scott
inline expression in SelectCommand   (224 Views)
Hi. I'm trying to put the multiple selected values in a Listbox into the 'WHERE' in the SQL-query. I'm almost there, but I get an error when I use in the SelectCommand. When I tried , it also didn't work.Could someone help me please.Code: Code: protected void Button1_Click(object sender, EventArgs e) { string gegeven; gegeven = "SELECT * FROM [ibs] WHERE [liedID] = 47"; foreach (ListItem item in ListBox1.Items) { if (item.Selected) { gegeven += " OR [liedID] = " + item.Value; } } HiddenField1.Value = gegeven; Panel1.Visible = false; Panel2.Visible = true;
showing message box from server side (client/server inline code)   (107 Views)
In my application on Submit button, I want to do the following in same sequence; 1. Check Duplicate in DB 2. If Exists send message to user 3. If user says Yes then insert into db 4. If user says no don't do anything On submit button I can check duplicates in DB in code behind file, if exists how can I send a message to user and take his input, I tried Response.Write(" confirm("duplicate!!") "); but it doesn't work. Can anyone tell me how can I acheive the above.
C# inline page load   (145 Views)
(insert very long story here..) Basically I have an aspx file that needs an inline Page_Load page so that the code inside this function will execute upon the loading of the page. The most obvious way that I have tried is: public Page_Load(object sender, EventArgs e){ do some stuff.... } Google has unfortunately failed me, does anybody know if this is possible
Render() and inline code.   (90 Views)
DanInManchester Manchester, England, UK Since 8/23/2002 Posts 2,464 Reputation 20,480 Reply Dan Bayley (DanInManchester) replied on 12/10/2006 6:47 AM rated by 0 users With a little help from Rick at WestWind and some googling on MSDN the solution is pretty obvious when you know how.I found the solution here :http://support.microsoft.com/default.aspxscid=kb;en-us;306575in the troubleshooting section.Although Rick's answer :Quote:Response.Write ouput cannot be captured in this way because the output goes directly into the Response stream immediately. IOW, it completely bypasses the rendering. If you need to capture this sort of thing you can look into using a Response Filter which allows you to look at anything that gets written into the stream. is a little more straight forward / clearer.http://west-wind.com/weblog/ShowPost.aspxid=481
BBCode [inline] feature   (85 Views)
So I was just searching if I could find a BBCode inline feature similar to the the one on this forum: like this And yeah, I did a search of the internet but the results are related to inline code (specifically in aspx), where you would not use a code-behind file but write scripts ON the actual page... So my question is: Is there a feature similar to the BBCode inline tag like this Oh and I'm not sure if this is the right forum to post this... This post has been edited by RexGrammer: 31 December 2011 - 11:59 AM
Validation summary problem   (243 Views)
I have a validation summary control that displays error messages for any required fields not filled out.For my phone number field, I validate to make sure that the field is filled out, and then a second validation to see if it had been filled out with the correct number of digits.If I don't fill out this (and other) fields, the valdation summary generates the appropriate error messages for all fields.However, if I fill in this field, but fill it in incorrrectly, the validation summary displays an error message, but all of the other error messages that should display disappear. Only the invalid entry message shows.Is this a .NET bug Has anyone else seen this
Regular expressions - problem to replace multyline html tag   (171 Views)
I'm using regular expressions to replace a multyline hyperlink:result_str = Regex.Replace(result_str, "]*>(.*)", "", RegexOptions.Multiline)This expression replaces all hiperlinks except for multyline hyperlinkThe following hyperlink was not replacedHow can I replace this kind of hyperlink with empty strin
Validation logic problems   (147 Views)
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require. Below is the script I currently use and what it does along with what I would like it to do. Can someone please help me work how I can fix this. function ValidateDropDownOrCheckBox(sender, args){ if ( document.forms[0].DropDownList1.value || ( document.forms[0].CheckBox2.checked && document.forms[0].CheckBox1.checked ) ) { args.IsValid = true; return; } args.IsValid = false;}*MY PROBLEMS WITH THIS CODE ARE: -At present the page is redirected if both checkboxes are checked and something is selected in the dropdown list. This needs to show an errorAlso the page shows an error if ONLY one checkbox is checked AND nothing is selected in the dropdown list. I want this sequence to be allowed. It also allows the page to redirect if one checkbox is checked and something is selected in the dropdown list. This need to show an error.I NEED MY LOGIC TO WORK LIKE SO: -If I tick one of the checkboxes (and nothing is selected in the dropdownlist) I want the arg to be TRUE (in other words allow page event to run)If I tick both of the checkboxes (and nothing is selected in the dropdownlist) I want the arg to be TRUE (in other words allow page event to run)If neither checkbox is checked but something is selected in the dropdownlist then I want the arg to be TRUE (in other words allow page event to run)If niether checkbox is checked and nothing is selected in the dropdownlist then i want the arg to be FALSE (in other words SHOW ERROR MESSAGE)
Server.Transfer problem   (139 Views)
I've been working on some code which will hopefully allow me to transfer the contents of an arraylist on one page over to another page. The Arraylist is held in the viewstate object as it is populated on the on-click event of a button. Im trying to move to another page and carry over the items in my arraylist and write them to the page. The code ive been trying to work with to achieve is detailed below. I am getting an error and im not sure exactly why or what im doing wrong and was wondering if someone could have a look and help me with this. To see exactly how my Arraylist is populated please see my recent post. I've been advised to use the Server.Transfer to access the arraylist on a seperate page, however as outlined below i've having some difficulty achieveing this. Could someone please help me.
MS Access Connection problems with ASP.NET   (163 Views)
I'm very new to ASP.NET and trying to contact an Access 2000 database in dreamweaver MX2004.I am able to set up a DSN connection using ASP VBScript (although that brings up error when I try to view the asp page).However, when I set up an OLE DB connection for ASP.NET VB and test the mdb file situated in c:\inetpub\wwwroot\test folder it finds it okay. But when I expand the connection in the Databases it shows none of the five tables or views or procedures.I've been stuck on this for a while now and I am sure I am missing something really obvious.I'd be grateful for any ideas
problem with typed datasets   (215 Views)
all,I wanted to create a typed dataset, I mean, my own dataset class derived from the DataSet class. To do this, I created an asp.net web application using vb.net. Then I right-clicked the project, clicked Add/Add Class and I chose the DataSet template. Then I drag a table from the Server Explorer into the designer.Finally, I used the following code in the main web form to retrieve data from a database and put it into the data set, but it's not working!Dim conn As New OracleConnection(ConfigurationSettings.AppSettings("connstr")) conn.Open()Dim da As New OracleDataAdapter("select * from sector", conn) Dim ds As New dsSector() 'my own dataset class da.Fill(ds, "consulta") Response.Write("nro. de filas: ") Response.Write(ds.Tables(0).Rows.Count) Response.Write(ds.SECTOR.Rows.Count) conn.Close()It doesn't show me any error, but it is not returning any row.Can anybody help me with this proble
problems using page.databind when outputting values from an object   (195 Views)
I'm using a page with several panels - I instantiate an object and using Page.DataBind(); in the subroutine in the codebehind and in the apsx page - so far so good.I then change the value in the object and use the same approach as above Page.DataBind(); in the subroutine in the codebehind and in a different panel the apsx page and I get System.NullReferenceException: and the error points to the line where I call Page.DataBind(); the second time.I've worked around this now but I'm curious why I should get the error in the first place
problem with typed datasets   (259 Views)
all,I wanted to create a typed dataset, I mean, my own dataset class derived from the DataSet class. To do this, I created an asp.net web application using vb.net. Then I right-clicked the project, clicked Add/Add Class and I chose the DataSet template. Then I drag a table from the Server Explorer into the designer.Finally, I used the following code in the main web form to retrieve data from a database and put it into the data set, but it's not working!Dim conn As New OracleConnection(ConfigurationSettings.AppSettings("connstr")) conn.Open()Dim da As New OracleDataAdapter("select * from sector", conn) Dim ds As New dsSector() 'my own dataset class da.Fill(ds, "consulta") Response.Write("nro. de filas: ") Response.Write(ds.Tables(0).Rows.Count) Response.Write(ds.SECTOR.Rows.Count) conn.Close()It doesn't show me any error, but it is not returning any row.Can anybody help me with this proble
problems using page.databind when outputting values from an object   (173 Views)
I'm using a page with several panels - I instantiate an object and using Page.DataBind(); in the subroutine in the codebehind and in the apsx page - so far so good.I then change the value in the object and use the same approach as above Page.DataBind(); in the subroutine in the codebehind and in a different panel the apsx page and I get System.NullReferenceException: and the error points to the line where I call Page.DataBind(); the second time.I've worked around this now but I'm curious why I should get the error in the first place