Using the variable in the code behind


Hi ,

My problem is using the value of a variable from the codebehind page in an html tag.
I have got the html code on default.aspx for example
and there is a variable in default.aspx.vb called THISPAGE.
And in the HTML code I want to use this string value in a form tag like this:



But when I run the page I got an error message that THISPAGE should be declared although I have declared it in the codebehind page.
Posted On: Tuesday 27th of November 2012 10:50:36 PM Total Views:  454
View Complete with Replies

RELATED TOPICS OF ASP.NET PROGRAMMING LANGUAGE




ascx page ddl control causing postback in holder

I have an aspx page that contains a pulldown, which, when an item is selected, it adds another control to a panel on the page.This new panel contains 2 dropdowns.\tWhen an item from dropdown1 is selected, it causes ddl2 to repopulate with a filtered list (from a sql db).\tThe problem is, when ddl1 is selected, it's causing the main page to do a postback, which is checking for a postback, which clears the panel.How do I get only the control to do a postback
VIEWS ON THIS POST

215

Posted on:

Tuesday 27th November 2012
View Replies!

Export to excel using vb.net codebehind

I have an asp.net application that I need to export data from a Oracle table to excel.\tI am writing data to an existing excel template.\tI was able to do this using OLEDB, however, when I write the data to the spreadsheet it inserts all data as text.\tHow can I do this and keep each fields datatype\tI have tried excel automation and ADODB, both of which I had issues when I added the refereces needed.\tI have also tried to set IMEX=0 and IMEX=2 in my connection string below.
VIEWS ON THIS POST

228

Posted on:

Tuesday 27th November 2012
View Replies!

Page.IsPostBack Confusing

,I'm modifying my original code to adapt with new change and now facing a problem... RESET button no long works!At first, I had 2 Sub function: Submit and Reset away from Sub Page_Load and Page.IsPostBack case.\tBut now with some added, I'd have to move Submit function to the If Page.IsPostBack then and somehow the Sub Reset doesn't response anymore.\tI wonder if it would work again when I somehow move the Reset to the Page.IsPostBack as well.\tIf so, how can I tell which is Submit and which is Reset in that Page.IsPostBack case.\tI meant they both are IsPostBack, right
VIEWS ON THIS POST

215

Posted on:

Tuesday 27th November 2012
View Replies!

LoginView causing all my objects to not exit

Hi ,I am trying to get an authentication system on the site I'm doing.I'm using LoginView on each of the two restricted pages to show either the login diaglog or the actual page content.When I encapsulate the actual page code in the and build the page it says that all my controls (used on the code behind page) don't exist in the current context.I'm thinking that this is because the code behind uses these controls but it can't see them when I'm not logged in (because the AnonymousTemplate is showing.Is there a bit of code or control I can use in an if statement to cut out my code behind when the user isn't logged in.BTW, I don't know if this is how most people would do it, the alternative I wanted to do is to have a test on the restricted pages and if the user isn't logged in redirect them to the login page. But I can't find the code or object for such a test - does any one know it
VIEWS ON THIS POST

147

Posted on:

Tuesday 27th November 2012
View Replies!

Exporting image to excel using asp.net (vb.net)

I have looked everywhere and I can't figure out how to export an image to excel. I have know how to export a datagrid to excel but I'm trying to export an image as well. I would appreciate any help.Eric
VIEWS ON THIS POST

238

Posted on:

Tuesday 27th November 2012
View Replies!

Getting Table from SQL Server using Datagrid

Hi Everyone!\t\tI have a ASP.NET webform\tthat brings data in from SQL Server 2000 and displays it on a page. I want to update the webpage while in IE using the following code:\t\t\t\t\t\t\t\t\t\t\t\tDim MyConnection As SqlConnection\t\t\tSub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)\t\t\t\tMyConnection = New SqlConnection("Data Source=SQLSERVER;Initial Catalog=upsizedCandidate;Integrated Security=True")\t\t\t\t\t\t\tIf Not (IsPostBack) Then\t\t\t\t\t\tBindGrid()\t\t\t\tEnd If\t\tEnd Sub\t\t\tSub MyDataGrid_Edit(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)\t\t\t\tMyDataGrid.EditItemIndex = CInt(E.Item.ItemIndex)\t\t\t\tBindGrid()\t\tEnd Sub\t\tSub MyDataGrid_Cancel(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)\t\t\t\tMyDataGrid.EditItemIndex = -1\t\t\t\tBindGrid()\t\tEnd Sub\t\t\tSub MyDataGrid_Update(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)\t\t\t\tDim DS As DataSet\t\t\t\tDim MyCommand As SqlCommand\t\t\t\tDim UpdateCmd As String = "UPDATE ToddsTable1 SET myNewCol1 = @myNewCol1, myNewCol2 = @myNewCol2"\t\t\t\tMyCommand = New SqlCommand(UpdateCmd, MyConnection)\t\t\t\tMyCommand.Parameters.Add(New SqlParameter("@myNewCol1", SqlDbType.NVarChar, 40))\t\t\t\tMyCommand.Parameters.Add(New SqlParameter("@myNewCol2", SqlDbType.NVarChar, 20))\t\t\t\tMyCommand.Parameters("@Id").Value = MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))\t\t\t\tDim Cols As String() = {"@myNewCol1", "@myNewCol2"}\t\t\t\tDim NumCols As Integer = E.Item.Cells.Count\t\t\t\tDim I As Integer\t\t\t\tFor I = 2 To NumCols - 2 'skip first, second and last column\t\t\t\t\t\tDim CurrentTextBox As TextBox\t\t\t\t\t\tCurrentTextBox = E.Item.Cells(I).Controls(0)\t\t\t\t\t\tDim ColValue As String = CurrentTextBox.Text\t\t\t\t\t\tMyCommand.Parameters(Cols(I - 1)).Value = Server.HtmlEncode(ColValue)\t\t\t\tNext\t\t\t\tMyCommand.Connection.Open()\t\t\t\tTry\t\t\t\t\t\tMyCommand.ExecuteNonQuery()\t\t\t\t\t\tMessage.InnerHtml = "Record Updated" & UpdateCmd.ToString()\t\t\t\t\t\tMyDataGrid.EditItemIndex = -1\t\t\t\tCatch Exp As SQLException\t\t\t\t\t\tIf Exp.Number = 2627 Then\t\t\t\t\t\t\t\tMessage.InnerHtml = "ERROR: A record already exists with the same primary key"\t\t\t\t\t\tElse\t\t\t\t\t\t\t\tMessage.InnerHtml = "ERROR: Could not update record, please ensure the fields are correctly filled out"\t\t\t\t\t\tEnd If\t\t\t\t\t\tMessage.Style("color") = "red"\t\t\t\tEnd Try\t\t\t\tMyCommand.Connection.Close()\t\t\t\tBindGrid()\t\tEnd Sub\t\t\tSub MyDataGrid_ItemDataBound(ByVal Sender As Object, ByVal E As DataGridItemEventArgs)\t\t\t\tIf (E.Item.ItemType = ListItemType.EditItem) Then\t\t\t\t\t\tDim i As Integer\t\t\t\t\t\tFor i = 0 To E.Item.Controls.Count - 1\t\t\t\t\t\t\t\tIf (E.Item.Controls(i).Controls(0).GetType().ToString() = "System.Web.UI.WebControls.TextBox") Then\t\t\t\t\t\t\t\t\t\tDim tb As TextBox\t\t\t\t\t\t\t\t\t\ttb = E.Item.Controls(i).Controls(0)\t\t\t\t\t\t\t\t\t\ttb.Text = Server.HtmlDecode(tb.Text)\t\t\t\t\t\t\t\tEnd If\t\t\t\t\t\tNext\t\t\t\tEnd If\t\tEnd Sub\t\tSub BindGrid()\t\t\t\tDim DS As DataSet\t\t\t\tDim MyCommand As SqlDataAdapter\t\t\t\tMyCommand = New SqlDataAdapter("select * from ToddsTable1", MyConnection)\t\t\t\tDS = New DataSet()\t\t\t\tMyCommand.Fill(DS, "ToddsTable1")\t\t\t\t\t\t\tMyDataGrid.DataSource = DS.Tables("ToddsTable1").DefaultView\t\t\t\tMyDataGrid.DataBind()\t\t\tEnd Sub\t\t\t\tUpdating ToddsTable1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tThe table is only 2 columns just to get something working but when I click the edit link my title still shows up but the table disappears. Any thoughts on what I could do differently
VIEWS ON THIS POST

176

Posted on:

Tuesday 27th November 2012
View Replies!

cannot view XML input using XSL style sheet

hello, I am really stuck and not sure what to do...I have just bought a asp.net 2.0 book for beginners and upon creating a page and trying to view i get get this message:-Cannot view XML input using XSL style sheet.The XML page cannot be displayed A name was started with an invalid character. Error processing resource 'http://paul/fornext.aspx'. Line 1, Position 2 so I got a copy of Visual Web Developer 2005 Express Edition and write files trhough that but it then opens up a port in order to show my files in a browser window!!Thus I turn for your advice, can you help me resolve this, I am stuck!Thank youPaul Watson
VIEWS ON THIS POST

220

Posted on:

Tuesday 27th November 2012
View Replies!

Insert/Update data from DetailsView using SQL view in DataSource

Hi all,I'm working with VisualStudio2K5 using the VWD interface.\tWhat I'm attempting is the following:I have two SQL tables, One containing Vendor info, and one containing lookup information for Vendor Terms.\tThere is a column in Vendor that contains the primary key for the appropriate record in the Vendor Terms table.\tI have established the appropriate relationship between the two tables in SQL.Now, what I'd like to do on my ASP page, is have a GridView which displays only a few crucial fields from the Vendor table, and then have a DetailsView or FormView that displays the complete information from the Vendor table for whatever record is selected on the GridView, as well as allowing for Inserting, Editing and Deleting within that DetailsView or FormView.So, I've created an SQL datasource for the Gridview pointing to the SQL view of both complete Vendor and VendorTerms tables.Then, I've created a second SQL datasource that grabs the single record that is selected in the Gridview and connected it to the Formview.This is where I run into problems.\tI would love to be able to edit info in this FormView for existing records, but I obviously want to have the lookup capability when I'm choosing my VendorTerms so I can see the descriptive column from the VendorTerms table in my drop down list rather than the PrimaryKey integer value.I thought I could do this by simply recreating the control in FormView for my VendorTerms as a drop down, doing the appropriate data binding and changing of column visible in the drop down list.\tThis would be great except that my FormView Datasource will not allow me to select the "Update,Insert, etc." check box in the Advanced window of it's properties.Can anybody out there tell me where I'm going wrong and lead me in the right direction
VIEWS ON THIS POST

158

Posted on:

Tuesday 27th November 2012
View Replies!

using asp.net or php, which is better for search engines?

, my company is interviewing a person to help us in our organic google listings. Our site is currently programmed using asp.net on windows server. The guy that is trying to earn our business claims the following:This info is third hand so please forgive the writer as she doesn't understand that Linux=php and ASP.NET = windows.CODE> 1. Switch our website from an ASP server to a Linux server for several>reasons:> a. Data can be organized so that search engines can spider our site>effectively. Right now that is not the case. For ex: any images we have>on our site prohibit the search engines from finding the keywords around>and after those images. With a Linux server, the search engines won't>even know the images are there. By the way, images don't help us at all>with optimization.> b. The search engines prefer Linux to ASP because they can read them>better and give extra 'points' towards optimization for those websites who>utilize Linux.> c. The style sheets can be separated and allow for spiders to flow>through our entire site easily.> d. ASP does not work well with the Mozilla Firefox browser, a>fairly popular one, and it causes verbage and images to be off kilter and>look sloppy. That won't happen with Linux.> 2. They have stated that the Coding of our site is very poor and outdated,>tags used to code the site by search engines are no longer supported in>the W3C (World Wide Web Consortium), which makes our web pages invalid to>today's standards. In fact they found 233 standard errors on the home>page alone, all of which hurt us in organic optimizationcan anyone confirm this
VIEWS ON THIS POST

197

Posted on:

Tuesday 27th November 2012
View Replies!

Reading multiple recordsets using ExecuteXmlReader()

This is about XML in .NET 1.x.\tI'm trying to use multiple recordsets in the same SPROC, calling them via SqlCommand.ExecuteXmlReader().\tIs there a way to emulate SqlDataReader.NextResult() to move through each recordset\tI know that method isn't available in XmlReader.I figure if this doesn't work, I can use a regular tabular recordset with a SqlDataReader and use a XmlTextWriter and construct everything by hand as one big document.
VIEWS ON THIS POST

196

Posted on:

Tuesday 27th November 2012
View Replies!

How do I inset text into a panel using codebehind

Hi I have a panel with a background image and I want to superimpose some text on this using codebehind, how do I do this. I've seen InnerHTML or InnerText and this seems to be what I need. What's the Panel attribute equivelent
VIEWS ON THIS POST

147

Posted on:

Tuesday 27th November 2012
View Replies!

Tracking user activity in the DB using cookies and Session() object

I want to collect user information and activity for each visit in my website. To do so I was thinking in use one cookie to identify user (or machine), this cookie would be permanent in users machine, and use another cookie to identify every session that will be eliminated when user closes the browser or similar.My site has also a private area where users can access previous registration and log in (this private area uses Session() object), but the rest of the site no log in is needed. Then, if user logs in during the visit, I would also store his/her user id in the users session information in the DB. So in the database I would store:\t-Sessions Table-Session_id (cookie with session number)User_num (if user logs in) Is the user id in the DB for registered users Machine_cookie (permanent cookie that identifies the machine)User_type (Registered or Anonymous) Registered when user logs in during the session, and Anonymous if user doesn t log in IP_addressUser_AgentIs_Carwler (True or False)Browser_name (i.e. IE)Browser_version (i.e. 6.0)Javascript_enabled (True or False)Cookies_enabled (True or False)UrlReferrerIs this a good way to track user activity using cookies in combination with ASP.NET Session() objectMore ideas, suggestionsThank you\t
VIEWS ON THIS POST

209

Posted on:

Tuesday 27th November 2012
View Replies!

Dynamically declare Datagrid using variable?

Is it at all possible to dynamically create a Datagrid using a variable as it's name\tI have tried and am either not doing something correct or it cannot be done.\tPlease help.\tI have tried the following with no success.Private Sub brunTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles brunTest.Click\t\t\t\tDim i As Integer\t\t\t\tDim strA As String\t\t\t\tDim strAi As String\t\t\t\tstrA = "dgDataGrid"\t\t\t\tFor i = 0 To 10\t\t\t\t\t\tstrAi = strA & i\t\t\t\t\t\tDim strAi as new Datagrid\t\t\t\t\t\tResponse.Write(strAi)\t\t\t\t\t\tResponse.Write("")\t\t\t\tNext\t\tEnd Sub
VIEWS ON THIS POST

153

Posted on:

Tuesday 27th November 2012
View Replies!

using dynamic dropdownlist

all,I am trying to create a dynamic dropdownlist in asp.net.using the following codefor (int i=DateTime.Now.Year-90;i
VIEWS ON THIS POST

185

Posted on:

Tuesday 27th November 2012
View Replies!

asp.net Graph using sql data

HiIm currently creating a graph and the two files that I am using are graph.aspx and graph.ascx as shown below. Currently I am using arrays to state the size and names of the bars however I would like this information to be gained from an sql query. The query is:SELECT OrganisationDetails.Name, SUM(InvoiceDetails.Total) AS TotalFROM\tInvoiceDetails INNER JOIN InvoiceContents ON InvoiceDetails.OrderID = InvoiceContents.InvoiceID INNER JOIN OrganisationDetails ON InvoiceDetails.OutletID = OrganisationDetails.OrganisationIDGROUP BY OrganisationDetails.Name, InvoiceContents.CompanyIDHAVING (InvoiceContents.CompanyID = 912)ORDER BY OrganisationDetails.NameIs there anyway of incorporating this information to produce the graph so that each record gained from the sql creates a bar and each total = the size of the bar\tgraph.aspx:\t\tvoid Page_Load(Object sender, EventArgs e) {\t\t\t\t\t\t\t\t\t\t// Declare our variables\t\t\t\tString [] sItems = new String[10];\t\t\t\tInt32 [] iValue = new Int32 [10];\t\t\t\t// Populate our variables\t\t\t\tsItems[0] = "Carrots";\t\t\t\tiValue[0] = 23;\t\t\t\t\t\t\t\tsItems[1] = "Peas";\t\t\t\tiValue[1] = 53;\t\t\t\t\t\t\t\tsItems[2] = "Celery";\t\t\t\tiValue[2] = 11;\t\t\t\t\t\t\t\tsItems[3] = "Onions";\t\t\t\tiValue[3] = 21;\t\t\t\t\t\t\t\tsItems[4] = "Radishes";\t\t\t\tiValue[4] = 43;\t\t\t\t\t\t\t\t\t\t\t\tsItems[5] = "test";\t\t\t\tiValue[5] = 43;\t\t\t\t\t\t\t\t// Set our axis values\t\t\t\tdngchart.YAxisValues = iValue;\t\t\t\t\t\t\t\t// Set our axis strings\t\t\t\tdngchart.YAxisItems\t= sItems;\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Provide a title\t\t\t\tdngchart.ChartTitle\t= "Inventory Breakdown:";\t\t\t\t\t\t\t\t// Provide an title for the X-Axis\t\t\t\tdngchart.XAxisTitle\t= "(units display actual numbers)";\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\tgraph.ascx:\t\tprivate String\t\t\t\t_sXAxisTitle;\t\tprivate String\t\t\t\t_sChartTitle;\t\tprivate Int32\t\t\t\t_iUserWidth = 300;\t\tprivate String []\t\t_sYAxisItems;\t\tprivate Int32 []\t\t_iYAxisValues;\t\tpublic Int32 UserWidth {\t\t\t\tget { return _iUserWidth; }\t\t\t\tset { _iUserWidth = value; }\t\t}\t\tpublic Int32 [] YAxisValues {\t\t\t\tget { return _iYAxisValues; }\t\t\t\tset { _iYAxisValues = value; }\t\t}\t\tpublic String [] YAxisItems {\t\t\t\tget { return _sYAxisItems; }\t\t\t\tset { _sYAxisItems = value; }\t\t}\t\tpublic String XAxisTitle {\t\t\t\tget { return _sXAxisTitle; }\t\t\t\tset { _sXAxisTitle = value; }\t\t}\t\tpublic String ChartTitle {\t\t\t\tget { return _sChartTitle; }\t\t\t\tset { _sChartTitle = value; }\t\t}\t\tvoid Page_Load(Object sender, EventArgs e) {\t\t\t\t\t\t\t\t// As long as we have values to display, do so\t\t\t\tif (_iYAxisValues != null) {\t\t\t\t\t\t\t\t\t\t\t\t// Color array\t\t\t\t\t\tString [] sColor = new String[9];\t\t\t\t\t\tsColor[0] = "red";\t\t\t\t\t\tsColor[1] = "lightblue";\t\t\t\t\t\tsColor[2] = "green";\t\t\t\t\t\tsColor[3] = "orange";\t\t\t\t\t\tsColor[4] = "yellow";\t\t\t\t\t\tsColor[5] = "blue";\t\t\t\t\t\tsColor[6] = "lightgrey";\t\t\t\t\t\tsColor[7] = "pink";\t\t\t\t\t\tsColor[8] = "purple";\t\t\t\t\t\t// Initialize the color category\t\t\t\t\t\tInt32 iColor = 0;\t\t\t\t\t\t// Display the chart title\t\t\t\t\t\tlblChartTitle.Text = _sChartTitle;\t\t\t\t\t\t// Get the largest value from the available items\t\t\t\t\t\tInt32 iMaxVal = 0;\t\t\t\t\t\t\t\t\t\t\t\tfor (int i = 0; i < _iYAxisValues.Length; i++) {\t\t\t\t\t\t\t\tif (_iYAxisValues[i] > iMaxVal)\t\t\t\t\t\t\t\t\t\tiMaxVal = _iYAxisValues[i];\t\t\t\t\t\t}\t\t\t\t\t\t// Take the user-provided maximum width of the chart, and divide it by the\t\t\t\t\t\t// largest value in our valueset to obtain the modifier\t\t\t\t\t\tInt32 iMod = Math.Abs(_iUserWidth/iMaxVal);\t\t\t\t\t\t// This will be the string holder for our actual bars.\t\t\t\t\t\tString sOut = "";\t\t\t\t\t\t\t\t\t\t\t\t// Render a bar for each item\t\t\t\t\t\tfor (int i = 0; i < _iYAxisValues.Length; i++) {\t\t\t\t\t\t\t\t// Only display this item if we have a value to display\t\t\t\t\t\t\t\tif (_iYAxisValues[i] > 0) {\t\t\t\t\t\t\t\t\t\tsOut += "" + _sYAxisItems[i] + "";\t\t\t\t\t\t\t\t\t\tsOut += "" + RenderItem(_iYAxisValues[i], iMod, sColor[iColor]) + "";\t\t\t\t\t\t\t\t\t\tiColor++;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// If we have reached the end of our color array, start over\t\t\t\t\t\t\t\t\t\tif (iColor > 8) iColor = 0;\t\t\t\t\t\t\t\t}\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t// Place the rendered string in the appropriate label\t\t\t\t\t\tlblItems.Text = sOut;\t\t\t\t\t\t\t\t\t\t\t\t// Drop in the Y Axis label\t\t\t\t\t\tlblXAxisTitle.Text = _sXAxisTitle;\t\t\t\t}\t\t}\t\t//****************************************************************************************\t\t// Graph.RenderItem Method\t\t//\t\t//\t\t// Generates a horizontal bar graph for a given item\t\t//****************************************************************************************\t\tprivate String RenderItem (Int32 iVal, Int32 iMod, String sColor) {\t\t\t\tString sRet = "";\t\t\t\tsRet += "";\t\t\t\tsRet += "";\t\t\t\tsRet += "" + iVal + "";\t\t\t\tsRet += "";\t\t\t\treturn sRet;\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
VIEWS ON THIS POST

282

Posted on:

Tuesday 27th November 2012
View Replies!

Send HTML email using URL as source

I want to be able to send an HTML email from with my ASP.NET code using System.Web.Mail where a URL is specified for the email content. Anyone know how
VIEWS ON THIS POST

225

Posted on:

Tuesday 27th November 2012
View Replies!

Passing Values using tag in HTML Code

hey ,I am using this Code in HTML Page to display all the Name from the Dataset CODE \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tNow u can see the checkboxes are created at the run-time as per the rows in the dataset and each is having the same id "CheckBox3"Now in the Code Window... at time of CheckBox3_CheckedChanged event i want to know which row is checked....Please help me..i feel like i am in hell.... be'se don't find any solution
VIEWS ON THIS POST

142

Posted on:

Tuesday 27th November 2012
View Replies!

using a crystal report with a dataset

Check out this thread:thread855-1123137Jim
VIEWS ON THIS POST

187

Posted on:

Tuesday 27th November 2012
View Replies!

anyone using 2.0 beta 2 yet?

Asp.net 2.0 has the neat little thing now where you can populate a gridview based on grabbing info from a query string.\tHere's my question.\tI have a gridview in a webpart that is displaying a small amount of info on our purchase orders.\tI want the user to be able to click on an item, which will transfer them to another page for complete details.\tI want to send the datakeyfield from the first gridview in a querystring to the second page.\tI know how to do this on code, but I was just curious if there is a GUI way to do it in 2.0.\tI have a hyperlink templated column in the first gridview and I have my navigateurl property setup to like details.aspx{0} - i thought that was how to do it, but I need to connect the datakeyfield with the {0}...
VIEWS ON THIS POST

158

Posted on:

Tuesday 27th November 2012
View Replies!

sending e-mails with or without attachments using aspx

Below is the code used to allow users to send e-mails. Now I need to modifiy the code to allow users the ability to send emails with or without attachments. How do I do this\t\tSub buttonSend_Click(sender As Object, e As EventArgs)\t\t\t\tDim emailMessage As MailMessage\t\t\t\temailMessage = New MailMessage\t\t\t\temailMessage.From = textEmail.Text\t\t\t\temailMessage.To = textTo.Text\t\t\t\temailMessage.Subject = textSubject.Text\t\t\t\temailMessage.Body = "Department: " & textDept.Text & vbcrlf & vbcrlf & "Name: " & textName.Text & vbcrlf & vbcrlf & "Url: " & textUrl.Text & vbcrlf & vbcrlf & "Message: " & textMessage.Text \t\t\t\t\t\tSmtpMail.SmtpServer="cfmsvr1254"\t\t\t\tTry\t\t\t\t\t\tSmtpMail.Send(emailMessage)\t\t\t\t\t\tlabelStatus.Text = "Thank You!"\t\t\t\t\t\tbuttonSend.Enabled = False\t\t\t\tCatch ex As Exception\t\t\t\t\t\tlabelStatus.Text = "Unable to send e-mail message."\t\t\t\tEnd Try\t\t\t\tEnd Sub\t\t\t\tSub buttonNewMessage_Click(sender As Object, e As EventArgs)\t\t\t\ttextEmail.Text = ""\t\t\t\ttextSubject.Text = ""\t\t\t\ttextDept.Text = ""\t\t\t\ttextName.Text = ""\t\t\t\ttextUrl.Text = ""\t\t\t\ttextMessage.Text = ""\t\t\t\tbuttonSend.Enabled = True\t\t\t\tlabelStatus.Text = ""\t\tEnd Sub
VIEWS ON THIS POST

133

Posted on:

Tuesday 27th November 2012
View Replies!