I have webdropdown inside a webdatagrid what I want to do is when the user search for a specific item from the webdropdown the remaining columns of the webdatagrid need to populate based on the value of the dropdown need help urgent.
e.g The grid has 5 columns 1 is webdropdown the reamining are the bounded fields the dropdown contains the item list so when the item selection changes the other column need to populate based on itemID.
Thanks in advance
Hi Kanran Khan,
Thank you for posting on our forums.
You can use the available SelectionChanged event for the WebDropDown to get the newly selected item's Value. You can use this to query your Database and set the WebDataGrid's DataSource property accordingly.
Please let me know if you have further questions regarding this matter.
Thanks for the quick response but I still have the problem because that can be used when you select the value from the dropdown but when the user type to search for a specific item then it does not work. I need to let user type and search his item and when he select any value from the matched items then I need to get the value of that item and fill the remaining fields.
Hi Kamran Khan,
I recommend using the available Client-Side Blur event to set HiddenField object's value to equal what is currently set for the WebDropDown. You should be able to achieve this using "eventArgs.get_currentValue();" from the Client-Side Blur event. Then you can perform a postback and use the value from the HiddenField to get the appropriate DataSource for the WebDataGrid.
Please let me know how this works for you.
look the structure of my grid below...
<ig:WebDataGrid runat="server" ID="ctl021" OnInitializeRow="ctl01_InitializeRow" OnLoad="ctl021_Load" DataKeyFields="RowNo"> <Columns> <ig:TemplateDataField Key="Item" VisibleIndex="1" > <Header Text="Product/ Services" > </Header> <ItemTemplate> <ig:WebDropDown OnSelectionChanged="ddItems_SelectionChanged" AutoPostBack="true" ClientEvents-Blur = "hi" DataSourceID="SqlData" ValueField="ItemID" ID="ddItems" runat="server" ></ig:WebDropDown> </ItemTemplate> </ig:TemplateDataField> <ig:BoundDataField DataFieldName="Qty" Key="Qty" VisibleIndex="3"> <Header Text="Qty"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Rate" Key="Rate" VisibleIndex="4"> <Header Text="Rate"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Amount" Key="Amount" VisibleIndex="5"> <Header CssClass="MyColor" Text="Amount"> </Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:Activation Enabled="true"></ig:Activation> <ig:EditingCore AutoCRUD="false" Enabled="true" BatchUpdating="true"> <Behaviors> <ig:CellEditing> <CellEditingClientEvents ExitedEditMode="grd_ExitedEditModeHandler" /> <EditModeActions MouseClick="Single"/> </ig:CellEditing> <ig:RowDeleting Enabled="true" /> </Behaviors> </ig:EditingCore> <ig:Selection RowSelectType="Single" CellSelectType="Single" CellClickAction="Row"> </ig:Selection> </Behaviors> </ig:WebDataGrid>
on client blur event I can get the data of the webdropdown but how can i get the row ID of the webdatagrid where i have to fill the remaining fields.
The WebDataGrid's RowID property is only used for the EditingCore Behavior. More specifically, it's used to identify the Row which a CRUD operation is being processed. However, if you want to simply find out which WebDropDown was modified so that you can update the remaining cells in the row, I recommend using the available ActiveCell property when the Activation behavior is enabled. With this, you can get a reference to the row object and it's members.
Please let me know if you have additional questions regarding this matter.
I have the activation behavior enabled in my webdatagrid as you can see below but I dont know how to get the active cell property of the webdatagrid in javascript can you please write a few line how to get the active cell property in javascript.
<Behaviors> <ig:Activation Enabled="true"></ig:Activation> <ig:EditingCore AutoCRUD="false" Enabled="true" BatchUpdating="true"> <Behaviors> <ig:CellEditing> <CellEditingClientEvents ExitedEditMode="grd_ExitedEditModeHandler" /> <EditModeActions MouseClick="Single"/> </ig:CellEditing> <ig:RowDeleting Enabled="true" /> </Behaviors> </ig:EditingCore> <ig:Selection RowSelectType="Single" CellSelectType="Single" CellClickAction="Row"> </ig:Selection> </Behaviors>
Thankx