Hi, Instead of using the dataset to fill the ddl, can you loop through each of the rows in datatable and add items to ddl with proper TEXT and VALUE. This way you would have the access ID as soon as the user selects any access level. To answer the second part of storing the id in the database, Can you write another stored procedure with IN parameters to do the update/insert into the database ? If yes, you can invoke this stored procedure to store the id. makes sense ? HTH Harry :-)
Harry Kris
Posts
-
Help with Drop Down Lists -
Help with Drop Down ListsI am not sure if you need help with saving data back in to the database OR finding the ID corresponding to access level selected by the user. If its the ID, Each item in the DropDownList has Text and Value. Text is the description that you see in the GUI and Value is something you associate with each description. In your case, 'Admin' is the text and '1' is the value. If myddl is the DropDownList, then myddl.Items.Add(new ListItem('Admin','1')); will add 'Admin' to the dropdownlist. Does that answer your question ? HTH Harry :-)
-
How do I remove plus sign on root node of a TreeView?Hi, The behaviour of the treeview control is dervied from treeview.htc javascript file(C:\Program Files\IE Web Controls\build\Runtime\treeview.htc - where you installed IE web controls). Now if you look through it, you will find
function generateJunctionNode(el, cJunction, nodeClass) { ... if (nodeClass == "parent" && element.getAttribute("showPlus") != false ) { if (el.getAttribute("expanded") == true) imageSrc += "minus.gif"; else imageSrc +="plus.gif"; } ... }
Thats the place where the decision to use '+' image or '-' image is made. If you can tamper with this piece of code, you should be able to acheive what you want. For Example,if (nodeClass == "parent" && element.getAttribute("showPlus") != false && nodeIndex != "0" ) /* If its not root node */
You must be aware that IE web controls are open sourced. Take a look at C:\Program Files\IE Web Controls\src\treenode.cs. You will findif (bParent && ParentTreeView.ShowPlus == true) { if (Expanded == true) { imageSrc += "minus.gif'>"; } else { imageSrc += "plus.gif'>"; }
You can apply the same logic here too. Well, thats only a direction you can take. You will have to dig more to get it working. Good luck with that. Do post your solution. HTH Harry :-) -
Textbox viewstate - Javascript date pickerHi, In my web application, I have a series of text boxes for date entry. Next to those boxes, i have a line that invokes and javascript calendar. Now, the calendar shows up just fine - the date that I select is populated in the textbox - Problem is that, If I create a postback by clicking on any server control, the dates that were populated using the javascript date picker disappears. For the same textboxes, if i type the date manually and create a postback, the value appears after the round-trip. I am not sure what causes this behaviour. Do you have a clue ? Thanks! Harry :-)
-
imagebutton onclickHi, You are right ! If you want to see all the dynamically created controls after each postback, you need to recreate those controls for each postback. The best way to do this would be to create a new method build_calendar, which would create all dynamic imagebutton controls. Then you can invoke this method from day_render, page_load or any other method you would like ! Inside page_load, you would want to call build_calendar, only for postbacks and not the first time. So use Page.IsPostBack property. Hope it helps. Harry :-)
-
imagebutton onclickHi, "But it doesn't have the properties .commandarguement. Only .gettype" The reason for this behaviour is probably you have declared your ImageButton variable as
Dim imgBut
instead ofDim imgBut as ImageButton
If you declare it this way, and look for properties, you will see the commandName property, in addition to other properties. Now you can assign any string to CommandName property so as to uniquely identify yur button.imgBut.CommandName = "but1"
Then in the event handler, Place code like below.Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Dim butID As String Dim butCmdName As String butID = CType(sender, ImageButton).ID butCmdName = CType(sender, ImageButton).CommandName End Sub
All it does is - Uses the parameter "sender", which is actually the button that you clicked on - Since it is defined as Object, you will have to cast it to a ImageButton. Voila ! For the purpose you have asked for, you can just use ID property to identify the ImageButton uniquely. I hope this helps you Harry :-) -
imagebutton onclickYou can also ImageButton's CommandName and CommandArgument properties. In the Click event handler, you can retrieve the values as shown below. private void ibDatePick_Click(object sender, System.Web.UI.ImageClickEventArgs e) { string parmCnt = ( (ImageButton) sender ).CommandArgument; } HTH :-) Harry