This is a migrated thread and some comments may be shown as answers.

telerik:GridDropDownColumn

5 Answers 85 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Srinath
Top achievements
Rank 1
Srinath asked on 20 Oct 2008, 02:57 PM
Ascx:
------------


 

<telerik:GridDropDownColumn DropDownControlType="DropDownList" UniqueName="UserGroupTypeID" SortExpression="UserGroupTypeName" HeaderText="Type"   

 

DataSourceID

="dsUserGrpTypes"

 

 

 DataField="UserGroupType" ListTextField="UserGroupTypeName" ListValueField="UserGroupTypeID" />


Ascx.cs:
--------------

 

protected

void UserGroupsGrid_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

 

if (e.Item is GridEditableItem && e.Item.IsInEditMode)

 

{

 

GridEditableItem editedItem = e.Item as GridEditableItem;

 

 

GridEditManager editMan = editedItem.EditManager;

 

 

GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("UserGroupTypeID"));

 

 

DropDownList ddList = editor.DropDownListControl;

 

 

PortalData pd = new PortalData();

 

 

DataSet dsUserGrpTypes = new DataSet();

 

dsUserGrpTypes =

UserGroupsData.UserGroupGetUserGroupTyeps();

 

ddList.DataSource = dsUserGrpTypes.Tables[0];

}

 }



Dropdown is showing no records even though my dataset is having records in it.

Pls help me out in this regard.

--Srinath

5 Answers, 1 is accepted

Sort by
0
Srinath
Top achievements
Rank 1
answered on 21 Oct 2008, 04:05 AM
Any one there from Telerik Team .. please help me out in this regard.

--Srinath
0
Vlad
Telerik team
answered on 21 Oct 2008, 06:06 AM
Hello Srinath,

Please remove DataSourceID declaration and let me know about the result.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Srinath
Top achievements
Rank 1
answered on 21 Oct 2008, 06:24 AM
I did that but not able to view the data :(.

Thanks,
--Srinath
0
Vlad
Telerik team
answered on 21 Oct 2008, 06:25 AM
Hi Srinath,

Can you send us small project where we can reproduce this?

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Srinath
Top achievements
Rank 1
answered on 21 Oct 2008, 06:37 AM

<

PortalControls:GridControl ID="UserGroupsGrid" EnableAJAX="false" EnableEmbeddedSkins="false" Skin="Default" runat="server" AllowMultiRowEdit="false" AllowMultiRowSelection="false" OnSortCommand = "OnSortClick" AllowSorting="True" AutoGenerateColumns="False" OnItemDataBound="UserGroupsGrid_ItemDataBound" OnItemCommand="UserGroupsGrid_ItemCommand" OnInsertCommand="UserGroupGrid_InsertCommand" OnUpdateCommand="UserGroupGrid_UpdateCommand" OnNeedDataSource="UserGroupsGrid_NeedDataSource" OnItemCreated="UserGroupsGrid_ItemCreated"> <PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add New User Group" CommandItemSettings-RefreshText="" EditMode="InPlace" DataKeyNames="UserGroupID,UserGroupType,UserGroupName">
<CommandItemTemplate>
<
asp:LinkButton ID="AddNew" runat="server" CommandName="InitInsert" CssClass="add-new execute">Add New User Group</asp:LinkButton>
</CommandItemTemplate><NoRecordsTemplate>
<p><asp:Label runat="server" ID="Label1">No User Groups</asp:Label></p>
</NoRecordsTemplate>
<Columns>
<telerik:GridBoundColumn UniqueName="UserGroupName" SortExpression="UserGroupName" HeaderText="Name" DataField="UserGroupName" />
<telerik:GridBoundColumn UniqueName="UserGroupDesc" SortExpression="UserGroupDesc" HeaderText="Description" DataField="UserGroupDesc" />

 

 

<telerik:GridDropDownColumn DropDownControlType="DropDownList" UniqueName="UserGroupTypeID" SortExpression="UserGroupTypeName" HeaderText="Type"

 

 

DataField="UserGroupType" ListTextField="UserGroupTypeName" ListValueField="UserGroupTypeID" />

 

 

<telerik:GridButtonColumn UniqueName="HasOrgGroups" ButtonType="linkButton" SortExpression="HasOrgGroups" ItemStyle-HorizontalAlign="Center" HeaderText="Has Student Groups?" CommandName="EDITUGORGGROUPS" DataTextField="HasOrgGroups" Text="No" />

 

 

<telerik:GridButtonColumn UniqueName="HasCustomFields" ButtonType="linkButton" SortExpression="HasCustomFields" ItemStyle-HorizontalAlign="Center" HeaderText="Has Profile Fields?" CommandName="EDITUGCUSTOMFIELDS" DataTextField="HasCustomFields" Text="No" />

 

 

<telerik:GridButtonColumn UniqueName="HasIndividualUsers" ButtonType="linkButton" SortExpression="HasIndividualUsers" ItemStyle-HorizontalAlign="Center" HeaderText="Has Individual Users?" CommandName="EDITUGUSERS" DataTextField="HasIndividualUsers" Text="No" />

 

 

<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ItemStyle-Width="55" ButtonType="linkButton">

 

 

<ItemStyle CssClass="editNew execute" />

 

 

</telerik:GridEditCommandColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

</

PortalControls:GridControl>

 

-------------------------------- That is my grid.......................................

Here is Cs code of Item Databound:
-------------------------------------------

///

<summary>

 

 

/// To bind the data to Dropdown in edit and Add links

 

 

/// </summary>

 

 

/// <param name="sender"></param>

 

 

/// <param name="e"></param>

 

 

protected void UserGroupsGrid_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

 

if (e.Item is GridEditableItem && e.Item.IsInEditMode)

 

{

 

GridEditableItem editedItem = e.Item as GridEditableItem;

 

 

GridEditManager editMan = editedItem.EditManager;

 

 

GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("UserGroupTypeID"));

 

 

DropDownList ddList = editor.DropDownListControl;

 

 

PortalData pd = new PortalData();

 

 

DataSet dsUserGrpTypes = new DataSet();

 

dsUserGrpTypes =

UserGroupsData.UserGroupGetUserGroupTyeps(); // here is the SP call .. containing a simple select statement.

 

ddList.DataSource = dsUserGrpTypes;

}

}



Tags
General Discussions
Asked by
Srinath
Top achievements
Rank 1
Answers by
Srinath
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or