Create a HashTable and add the control id as key and control value as value. Then at postback get the control's value using Request.Form(control_id) and create the control again and assign it the same value. Example : Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try If Not IsNothing(ViewState("ht")) Then Dim v_ht As New Hashtable v_ht = CType(ViewState("ht"), Hashtable) For i As Integer = 0 To v_ht.Count - 1 'getting value of 1st control Dim a = Request.Form("txt_1") 'getting value of 2nd control Dim b = Request.Form("txt_2") Next Else Dim ht As New Hashtable 'dynamically created 1st control Dim txt As TextBox txt = New TextBox txt.ID = "txt_1" txt.Text = "CODE" &n
Kapil Thakur
Posts
-
getting value of dynamic textbox after post back -
how to bold a particular item of a dataset programaticallyDataset does not supports adding styles or formatting for text. However you can add style or text formatting to its binding control like gridview etc.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
related to websiteuse SQL cache dependency with page output cache. whenever there will be change in database table data your page data will be automatically reacreated, thus solving your problem. Google for it, you'll find many articles
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Replacing the Old File With Newly Uploaded Fileuse a hyperlink instead of linkbutton and give the path of the file in its NavigateURL attribute.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
searching for v.good web hosting serviceIm afraid i dont know much about VPS hosting. but going through their site....i found it very expensive You can have a look at this link http://www.computinghost.com/windows\_web\_hosting\_files/windows-hosting-information.html Alternatively you can drop a mail to the support team of ComputingHost.com specifying your business needs and ask them whats the best plan for you? Then you can decide further on your own. Also do cross check from other sites as well as there are huge differences in pricing across internet. It is really a confusing thing and you need to double check everything before going for any option anywhere.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
searching for v.good web hosting serviceHave a look at www.ComputingHost.com they have good plans and after sales support.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
showing image im gridview from ms accesssave the relative path of the image in the database. Put an image control in item template of gridview. bind the image control with the relative path of the images and the image will show.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Setting value for datarow if its null [modified]google for ((what) ? then : else) C#
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Setting value for datarow if its null [modified]IIF is in vb.net for C# its ((what) ? then : else) Apologies for the goof up
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Asp.net page getting expired - "internet explorer cannot dispaly a message"the way you are doing currently is almost impossible and senseless to keep page alive for so long. However you can make an asynchronous call to a function which will do all the required processing and after successful completion will sent back confirmation through ws_callback method. then you can show the "successfully done" message to confirm that processing has been done. You can google for asynchronous calls
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Export data from datatable to Excelgive a linkbutton "export to excel" and do the following code on its click event Dim Grid As New System.Web.UI.WebControls.GridView Try Grid.AutoGenerateColumns = True Grid.RowStyle.Wrap = True Grid.AlternatingRowStyle.Wrap = True Grid.DataSource = [YOUR DATASET] Grid.DataBind() -- header style required by you for excel Grid.HeaderRow.Cells(0).Width = 200 Grid.HeaderRow.Style("font-family") = "Verdana" Grid.HeaderRow.Style("font-size") = "12px" Grid.HeaderRow.Font.Bold = True Grid.HeaderRow.ForeColor = Color.White Grid.HeaderRow.BackColor = Color.Blue For Each row As System.Web.UI.WebControls.GridViewRow In Grid.Rows -- row style required by you for excel row.Cells(0).Width = 100 row.Style("font-family") = "Verdana" row.Style("font-size") = "12px" row.Style("text-align") = "left" Next Response.Clear() Response.AddHeader("content-disposition", "attachment;filename=" & [YOUR PREFERRED FILE NAME] & ".xls") Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.ContentType = "application/vnd.xls" Dim stringWrite As New System.IO.StringWriter() Dim htmlWrite As New HtmlTextWriter(stringWrite) Grid.RenderControl(htmlWrite) Response.Write(stringWrite.ToString()) Response.End() Catch ex As Exception Finally Grid.Dispose() Grid = Nothing End Try
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Setting value for datarow if its null [modified]try using the following code : foreach (DataRow dtRow in dtTrackingData.Rows) { SqlHelper.ExecuteNonQuery ( myConnectionString , "SP_NAME" , iWeekNo , Convert.ToInt32(dtRow["InvCoID"]) , IIF(IsDBNull(dtRow["LatestReportDateConsensus"]), "null" , dtRow["LatestReportDateConsensus"] ) , Convert.ToDateTime(dtRow["LatestReportDateVirtua"]) ,dtFromDate ,dtToDate ,CreatedBy ); } i have used IIF function; it checks if datevalue is true for dbnull then adds null in database else the datevalue of datatable column
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Display progress status informationUse AJAX, place an update panel and keep changing text of a label based on the functionality you are doing. Example, when executing code for creating file1....put label text as creating file1. then afterwards when saving in database....put label text as saving data etc.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Windows Service doubtinstall the service in your system. start the service. Click the "Tools" tab in Microsoft Visual Studio project. Click "Attach To Process" option. it will be show a list of services running in your system. Locate your service name and double click it. It will attach debugger to your service. Now when your service will run you will be able to debug it in your VS.Net project.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Changing text of embedded image in emailHi, I am sending an embedded image in an email. now i want to change some text in the image for every user. how can i do that ? Is there any way that i can fetch the text of an image and change it and then embed the new image in the email.
Thanks and Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
creating image of a web pagehow can i create an image of a web page by either web or windows application. example, www.yahoo.com is the url. i want to create an image of this url. Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
pop up window on datagridjust add target = "_blank" to the hyperlink html property Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
Preventing multiple call to button's event handlerhi, i have added a button in windows datagrid. it works fine when i load the grid first time and click the button. but if i reload the datagrid again on some event and i click the button, its click handler is called twice. if i again load the grid then the click handler is called thrice. how can i correct this ? i want to call the button's click handler only once like in normal application.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
View Sourcehi, YOU CANNOT DO THAT. you can stop the right click on browser....but you cannot disable ViewSource menuitem in View menu in toolbar.......it just cannot be achieved by any means.... i once had the same problem. you can decrypt the code but make sure to take a back up of html. Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
IE pagesetup property for printersetup through javascript?hi, use the follwing code in section and change the text in BOLD to your values javascript:window.open('http://www.YOUR URL.com','YOUR PAGE TITLE','width=570,height=650,top='+((screen.height/2)-(NaN))+',left='+((screen.width/2)-(NaN))+',toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no'); Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com </x-turndown>