c#


Obout DropDownList Showing Incorrect Selection On Add New


On first page load the drop down list in edit template shows select please value as selected and the selected value is 0.but when I change this value then on the very next add new the selected index shown in drop down list is the previous one.while it should show select please for every new item. I have tried all possible ways but all went in vain.
Here Is My Code.
<cc1:Grid ID="gridStaff" runat="server" FolderStyle="~/Styles/premiere_blue" Width="600px" AllowAddingRecords="true" AllowFiltering="false" CallbackMode="true" Serialize="true" AllowColumnReordering="true" AllowPaging="true" AutoGenerateColumns="false" EnableRecordHover="true" EnableTypeValidation="false" PageSize="25" OnRebind="RebindGrid" OnInsertCommand="InsertRecord" OnDeleteCommand="DeleteRecord" OnUpdateCommand="UpdateRecord" OnRowDataBound="gridStaff_RowDataBound" >
<ClientSideEvents OnBeforeClientDelete="Row_Deleting" />
<ScrollingSettings ScrollWidth="100%" />
<Columns>
<cc1:Column DataField="SalesPerson_Id" Visible="false" ReadOnly="true"
HeaderText="SalesPerson ID" runat="server">
<TemplateSettings RowEditTemplateControlId="SalesPerson_Id" RowEditTemplateControlPropertyName="value" />
</cc1:Column>
<cc1:Column DataField="SalesPerson_ID_V3Account" HeaderText="Username" Width="20%" runat="server">
<TemplateSettings TemplateId="SalesPerson_V3Account" RowEditTemplateControlId="SuperForm1_SalesPerson_ID_V3Account" RowEditTemplateControlPropertyName="value" />
</cc1:Column>
</Columns>
<ClientSideEvents OnClientEdit="onAddEdit" OnBeforeClientUpdate="onBeforeInsertUpdate" OnClientPopulateControls="onClientPopulateControls"
OnBeforeClientInsert="onBeforeInsertUpdate" OnBeforeClientCancelEdit="onBeforeClientCancelEdit" OnClientCancelEdit ="onBeforeClientCancelEdit" />
<Templates>
<cc1:GridTemplate runat="server" ID="SalesPerson_V3Account">
<Template>
<%# GetUserNameById(Convert.ToInt32(Container.DataItem["SalesPerson_ID_V3Account"]))%>
</Template>
</cc1:GridTemplate>
</Templates>
<TemplateSettings RowEditTemplateId="tplRowEdit" />
<Templates>
<cc1:GridTemplate runat="server" ID="tplRowEdit">
<Template>
<input type="hidden" id="SalesPerson_Id" />
<table width="100%" class="rowEditTable">
<tr>
<td>
<fieldset style="padding:5px; width:100%;">
<legend>Sales Person Detail</legend>
<table>
<tr>
<td>V3 Account
</td>
<td>
<cc3:OboutDropDownList ClientIDMode="Static" runat="server" ID="SuperForm1_SalesPerson_ID_V3Account" Width="300" Height="175"
DataSourceID="odsQCSUsers" DataTextField="username" AppendDataBoundItems="true" DataValueField="user_Id">
<asp:ListItem Text="Please Select" Value="Please Select" Selected="True"> </asp:ListItem>
</cc3:OboutDropDownList>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr>
<td >
<cc3:OboutButton runat="server" FolderStyle="~/Styles/premiere_blue/interface/OboutButton" Text="Save" OnClientClick="gridStaff.save(); return false;" ValidationGroup="1"
Width="75" />
<cc3:OboutButton runat="server" FolderStyle="~/Styles/premiere_blue/interface/OboutButton" Text="Cancel" OnClientClick="grid.cancel(); return false;"
Width="75" />
</td>
</tr>
</table>
</Template>
</cc1:GridTemplate>
</Templates>
</cc1:Grid>
Edits:
Temporarily , I Solved This Problem By Using ClientSideEvents i.e OnClientPopulateControls Function.
I Simply Added Following Lines In My Gridview.
<ClientSideEvents OnClientPopulateControls="onClientPopulateControls"/>
function onClientPopulateControls(record,type) {
if (type == "add")
{
record.SalesPerson_ID_V3Account = "Please Select";
record.SalesPerson_TeamType="Please Select";
}
}
But ,Still Looking For A Better And Reliable Solution.
Thanks!

Related Links

is there a e.ClickedItem for holding event
Getting document text from webbrowser
adding buttons at custom places in windowsform c# panel
ReactiveUI execute command on load
Get datetime value from registry
WPF Removing a Tab doesn't dispose contents?
Some specific questions to GDI+ in C#
How do I make the cursor to go back to RichTextBox after clicking a button?
C# - Concurrent Requests to database
Send Bar code from android app to C# desktop application via usb cable
Sending message to custom group using SignalR
Background intelligent Service BITS - Impersonate account
Which C# pattern has better performance to avoid duplicated event handlers?
How to update large object in Entity Framework
TF50608: Unable to retrieve information for security object - Unable to get into Collection administrative panel
Text comparison greater than

Categories

HOME
spring-boot
classification
itunesconnect
casting
apache-storm
magento-1.9.2.1
grid
jshell
uml-designer
servicenow
yacc
rtc
dcos
openbsd
solidity
facebook-marketing-api
versioning
summernote
webgl-earth
bug-reporting
ng-tags-input
traveling-salesman
orgchart
gulp-jshint
drawrect
jmsserializerbundle
ng2-bootstrap
log4net-configuration
wercker
contextmenustrip
epub
azure-vm-scale-set
azure-storage-files
abide
rythm
office-interop
contenteditable
paperclip
f#-fake
gradlew
android-doze-and-standby
spring-data-commons
opticalflow
tsc
timefield
dbi
netlink
instaparse
key-value-store
change-password
camellia
treelist
pyshark
clique
periodic-processing
nonblocking
webservices-client
bootstrap-tabs
android-filterable
pdcurses
euro
fileinputstream
data-representation
accpac
asp.net-2.0
firebase-tools
mri
unityvs
os.walk
oxygenxml
episerver-7
reactjs-native
jsmpp
db2-connect
maven-javadoc-plugin
jfilechooser
google-voice
kohana-orm
wpa
codeigniter-form-helper
wpml
google-email-audit-api
github-archive
nsscrollview
nude.js
scsf
wdm
jexcelapi
lwp
mass-emails
pixel-bender
asp.net-1.1
weak-typing
urlscan
tracd

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile