asp.net


Telerik Radgrid: accidentally populating grid with all query fields


I'm using the telerik rad grid. I successfully import the data & the 6 fields I choose to use, however after these 6 fields, my radgrid is reimporting ALL fields from my database query, using their field names as the column headers. So in total, my query calls 9 fields, so I have a total of 15 columns. My 6 that I want to have (plus 2 add'l columns for "Edit" & "Delete"), plus the 9 from my query.
The headers I want are as follows:
Name | Description | Image | Start Date | End Date | Active
Instead, I get this:
Name | Description | Image | Start Date | End Date | Active | Email Promotion Id | Promotion Title | Promotion Description | Image Name | Start Date | End Date | Deep Link Id | Active | Update Username
Here's my radgrid:
<telerik:RadGrid
ID="rgPromotions"
runat="server"
AllowPaging="true"
AllowSorting="true"
autopostback="false"
OnItemDataBound="rgPromotions_ItemDataBound"
OnNeedDataSource="rgPromotions_NeedDataSource"
Skin="Office2007">
<MasterTableView DataKeyNames="EmailPromotionId" Width="100%" TableLayout="Fixed" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="True" >
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px" ></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True" >
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="PromotionTitle" HeaderText="Name" SortExpression="PromotionTitle" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" ReadOnly="true" />
<telerik:GridBoundColumn DataField="PromotionDescription" HeaderText="Description" SortExpression="PromotionDescription" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" ReadOnly="true" />
<telerik:GridBoundColumn DataField="ImageName" HeaderText="Image" SortExpression="ImageName" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" ReadOnly="true" />
<telerik:GridDateTimeColumn DataField="StartDate" DataType="System.DateTime" FilterControlAltText="Filter Start Date column" HeaderText="Start Date" PickerType="DatePicker" DataFormatString="{0:d}" ReadOnly="true"/>
<telerik:GridDateTimeColumn DataField="EndDate" DataType="System.DateTime" FilterControlAltText="Filter End Date column" HeaderText="End Date" PickerType="DatePicker" DataFormatString="{0:d}" ReadOnly="true"/>
<telerik:GridBoundColumn DataField="Active" HeaderText="Active" SortExpression="Active" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center" ReadOnly="true"/>
<telerik:GridTemplateColumn DataField="EmailPromotionId" HeaderText="" ColumnGroupName="Edit" AllowFiltering="false" UniqueName="EmailPromotionIdEdit">
<ItemTemplate>
<asp:LinkButton ID="btnEdit" runat="server" Text="Edit" OnClick="btnEmailPromotionEdit_Click" CommandName="EmailPromotionId" CommandArgument='<%#Eval("EmailPromotionId") %>'></asp:LinkButton><br />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="EmailPromotionId" HeaderText="" ColumnGroupName="Edit" AllowFiltering="false" UniqueName="EmailPromotionIdEdit">
<ItemTemplate>
<asp:LinkButton ID="btnDelete" runat="server" Text="Delete" OnClick="btnEmailPromotionDelete_Click" CommandName="EmailPromotionId" CommandArgument='<%#Eval("EmailPromotionId") %>'></asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Any idea how I'm accidentally importing these additional fields?
Thanks
Set AutoGenerateColumns="false" in your grid's main definition:
<telerik:RadGrid
ID="rgPromotions"
AutoGenerateColumns="false"
...

Related Links

Connection Closing error
ASP.NET Forms Authentication Across Applications Issue
Disable URL encoding
Handle Oracle Database Connection in Dapper
500 error when uploading an image from iOS to IIS post webservice
Render control as ASP not HTML
Asp.net Core + IIS 8.5 : The view 'Index' was not found
Accessing X509CertificateStore from Server Machine
Datapager not working with ListView
ASP.NET - Raise select node of treeview in Masterpage from content page
Set an ASP.NET HyperLink NavigateUrl to a relative path?
Should project.lock.json file be checked into source control? (ASP.NET Core 1.0)
MVC 5, other languages for layout are working but for views and partial views not
Why shouldn't I use IIS Express for ASP.Net Core development?
Add CompareValidator to TextBox that is hidden until a button is clicked
Read text file from server and split into multiple file in asp.net

Categories

HOME
qlikview
stanford-nlp
customization
ldap
wifi
ebay-api
singleton
uml-designer
jquery-select2
tracking
popup
dat.gui
web-parts
ringcentral
beacon
audio-streaming
aiml
summernote
serenity-js
inline-assembly
continuous-fourier
hierarchy
openoffice-impress
scene7
rtos
wit-ai
azure-storage-files
framebuffer
word-wrap
nscollectionview
cakephp-3.2
risc
api-key
logan-square
django-cors-headers
line-endings
monaca
standard-error
appcmd
node.js-client
suitesparse
timefield
consolidation
boost-range
android-xmlpullparser
bytearray
jde
factorization
video-embedding
yfiles
overlapping
database-project
openhab
dcg
minko
gmaps4jsf
veeam
google-experiments
douglas-peucker
fedena
report-builder2.0
im4java
azure-caching
fastcgi-mono-server
git-subtree
node-mongodb-native
data-layers
nomachine
jython-2.5
infinity.js
bho
architectural-patterns
ntdll
blotter
nsscrollview
nsundomanager
utm
html5-animation
silverlight-2.0
mysql-pconnect
user-preferences
wtsapi32
qlibrary
content-delivery-network

Resources

Encrypt Message