Hi All, I have a checkboxlist(created from db) on form where user can selected multiple items when click on update button the form send the data to sql server database. This work fine, the problem I have when the user open the form for the same record number and want change the checkboxlist items. How do I go about doing this ? For example: first time around user selected item 1,3,7,9 and 10 Second time around user selected item 2,3,5,7,9 and 10. Any assistance is greatly apprecaited. please provide codes example. Thanks DocHoliday. my code for the inserting to the db, the field that get insert are Application_id, Item# and Module (primary Key in db). Protected Sub GetCheckedModule() Dim MyItem As ListItem mstrSelectedColumns = "" For Each MyItem In chkbModule.Items If MyItem.Selected = True Then Session("Module") = MyItem.Value Insert_SelectedModule() End If Next End Sub
AsianRogueOne
Posts
-
Update Multiple Selected Item from Checkboxlist to SQL server database -
Search and Replace String ValueThanks
-
Search and Replace String ValueCan you show example regarding the OR's having run the procedure multiple times and join the datasets that are returned ?
-
Search and Replace String ValueHi, I am basically building a page that allow user to create their own report. On the page I got all the columns of the table displayed for user to pick to show on the report. Next if they wish do a drill down then they would select criteria as they select the criteria(s) I need to group the "AND" and "OR" to send to the store procedure as one query. Thanks, DocHoliday
-
Search and Replace String ValueI forgot to mentioned that the @Filters varaible is the where clause.
-
Search and Replace String ValueHi, I started writing a function to do the replace/insert but ran into issue when there are more then one "AND" then follow by "OR", the "(" get insert after the first "AND". Also when there blank space after the "OR" at the end of the string the function fail. Thanks, DocHoilday Function codes: Private Function ReplaceString(ByVal strValue As String) As String Dim andIndex As Integer = strValue.IndexOf("AND") Dim blankIndex As Integer = strValue.IndexOf("Blank") Dim orIndex As Integer = strValue.IndexOf("OR") Dim nextAndIndex As Integer = strValue.IndexOf("AND", andIndex + 3) Dim secondBlankIndex As Integer = strValue.IndexOf("Blank", blankIndex + 5) Dim temp As String = String.Empty if orIndex > andIndex AndAlso orIndex < secondAndIndex Then temp = strValue.Substring(0, andIndex + 3) + " (" temp += strValue.Substring(andIndex + 3, secondAndIndex - andIndex - 3).Trim() + ") " temp += strValue.Substring(secondAndIndex) ElseIf orIndex > andIndex AndAlso orIndex < secondBlankIndex Then temp = strValue.Substring(0, andIndex + 3) + " (" temp += strValue.Substring(blankIndex + 5, secondBlankIndex - blankIndex - 5).Trim() + ") " temp += strValue.Substring(secondBlankIndex) End If Return temp End Function Here is the SP code: CREATE PROCEDURE Get_Build_My_Report ( @Application_id CHAR(5), @DisplayColumn VARCHAR(2000), @Filters VARCHAR(1000) = NULL ) AS DECLARE @Select VARCHAR(60) DECLARE @FROM VARCHAR(60) DECLARE @JOIN VARCHAR (2000) DECLARE @WHERE VARCHAR(60) DECLARE @TempColumnName VARCHAR(1000) DECLARE @Var VARCHAR(1000) SET @Select = 'SELECT' SET @FROM = 'FROM Issues_Tracking it' SET @JOIN = 'LEFT JOIN User_mstr um ON it.Assigned_To_id = um.userid AND it.application_id = um.application_id LEFT JOIN Status s ON it.status = s.status_id LEFT JOIN NGModules m ON it.module = m.mod_id AND it.application_id = m.application_id LEFT JOIN Rank_level rl ON it.rank = rl.rank_id LEFT JOIN NGProducts p ON it.product = p.product_id LEFT JOIN Request_Type rt ON it.Request_Type = rt.Request_Type_id LEFT JOIN practice pr ON it.Practice_id = pr.practice_id LEFT JOIN Response r ON it.Submitted_to_Vendor = r.Answer_id LEFT JOIN Response r2 ON it.Issues_Known_To_Vendor = r2.Answer_id LEFT JOIN Environment e ON it.Environment = e.Environment_id
-
Search and Replace String ValueHi All, I have a string variable contain text that I would like to search for "Keyword" (AND, OR ) I like to do is search the string varaible strValue for the word "AND" that follow by word "OR" and insert "(" and the last word "OR" and insert ")" .The last "OR" might have "AND" or blank space, The combination could be any order I need to place the "(" and ")" where the "OR" exist. For Example: Orignal strValue = " col1 = "John" and col4 = "smith" and col3 = "John" or col7 <> "closed" or col9 > 1 and col5 = "passed" " After the replace the strValue should be : strValue = " col1 = "John" and col4 = "smith" and (col3 = "John" or col7 <> "closed" or col9 > 1 ) and col5 = "passed" " The strValue then send to SQL store procedure as a where clause in sql statement. Any assistance is greatly apprecaited. please provide codes example. Thanks DocHoliday.
-
Get all selected ros from gridview.Hi All, I have a gridview with 26 rows and four columns dynamically build. Each row there have two columns with dropdownlist and a textbox. I need to capture all the rows and column that have data selected when user click submit button to send to sql database. Being newbie to asp.net not sure how to accomplish this. Any help is greatly appreciated. col1 col2 col3 col4 firstname ddl1 ddl2 textbox lastname ddl1 ddl2 textbox dob ddl1 ddl2 textbox addrs ddl1 ddl2 textbox Thanks, DocHoliday
-
change output format dynamic checkboxlist in asp.net/vbNever mind I figured it out. Thanks.
-
change output format dynamic checkboxlist in asp.net/vbHi All, Newbie to ASP.Net, I created a dynamic checkboxlist that populated from a database in asp .net vb. Not sure if it is possible but I would like format the checkboxes to diplay on my page so many on each column. Somthing like: checkbox 1 checkbox 6 checkbox 2 checkbox 7 checkbox 3 checkbox 8 checkbox 4 checkbox 9 checkbox 5 checkbox 10 Any help greatly appreciated. Thanks DocHoliday. :confused:
-
Get the first and last row for each child rowThanks
-
Get the first and last row for each child rowI need to get the first and last row because my page allow user to move the order of the child row up/down. Therefore, if the child row is first row then user cannot move it up and same for last row, user cannot move it down.
-
Get the first and last row for each child rowDoes repeater have the same function as gridview does ?
-
Get the first and last row for each child rowHi All, I am a newbie to ASP.NET and in need of you help, basically, I have a gridview that binded from two functions (type datatable). One function is parent which I past one parameter ("DeptID") while loading this table I also called the child funtion which get the parameter from the parent function ("FolderID"). The grid bind fine, but my tast is to place a down arrow at the first child row under the parent and an a up arrow at the last child row and the process repeated for each parent that have one or more rows. This is where I have been banging head head trying to get this work but has no success. Parent row data1 Down arrow Child row data - first row up/down arrow Child row data up/down arrow Child row data up/down arrow Child row data up arrow Child row data - last row Parent row data2 Down arrow Child row data - first row up/down arrow Child row data up/down arrow Child row data up arrow Child row data - last row Parent row data3 Down arrow Child row data - first row up/down arrow Child row data up arrow Child row data - last row Parent row data4 Child row data - first row Any assistance is greatly apprecaited. please provide codes example. Thanks DocHoliday. Here are my codes behind VB: Protected Sub DisplayParentGV() Dim Conn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("mConn").ToString) Dim SQLCmd As New SqlCommand("Get_Links_Name", conn) Dim SQLDBDataReader As SqlClient.SqlDataReader Dim dt As New DataTable() Try If conn.State = ConnectionState.Closed Then conn.Open() End If SQLCmd.CommandType = CommandType.StoredProcedure SQLCmd.Connection = conn SQLCmd.Parameters.Add("@DeptID", SqlDbType.Int, 60).Value = Convert.ToInt32(Session("Dept_id")) dt.Columns.Add(New DataColumn("FolderID", GetType(String))) dt.Columns.Add(New DataColumn("FolderFileID", GetType(String))) dt.Columns.Add(New DataColumn("ImageType", GetType(String))) dt.Columns.Add(New DataColumn("Page", GetType(String))) dt.Columns.Add(New DataColumn("FolderOrder", GetType(String))) dt.Columns.Add(New DataColumn("Link_FileOrder", GetType(String))) SQLDBDataReader = SQLCmd.ExecuteReader() While SQLDBDataReader.Read() Dim dr As DataRow = dt.NewRow() Di