Click here to Skip to main content
15,890,717 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: problem in displaying money in grid view. Pin
michaelschmitt6-Jun-10 23:29
michaelschmitt6-Jun-10 23:29 
GeneralRe: problem in displaying money in grid view. Pin
souravghosh187-Jun-10 0:21
souravghosh187-Jun-10 0:21 
GeneralRe: problem in displaying money in grid view. Pin
michaelschmitt7-Jun-10 1:56
michaelschmitt7-Jun-10 1:56 
GeneralRe: problem in displaying money in grid view. Pin
Goutam Patra7-Jun-10 2:58
professionalGoutam Patra7-Jun-10 2:58 
AnswerRe: problem in displaying money in grid view. Pin
The solution7-Jun-10 0:45
The solution7-Jun-10 0:45 
Questioncan't see the background-image of a master page Pin
benams6-Jun-10 22:47
benams6-Jun-10 22:47 
AnswerRe: can't see the background-image of a master page Pin
saini arun6-Jun-10 22:58
saini arun6-Jun-10 22:58 
QuestionDropdownlist not displaying selectedItem in GridView Pin
meeram3956-Jun-10 22:03
meeram3956-Jun-10 22:03 
I have a Gridview in my form and I use SqlDataSource to fill the Grid. I have an Edit button also in the Gridview to Edit data.

The problem is while clicking on Edit, the dropdownlist in the Gridview
is not displaying the item selected, but going to the first item of the dropdownlist. How should I make the selected item
displayed while click on Edit?

Please find below my code:

<asp:GridView ID="grdDTCCRics" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" 
         DataKeyNames="REDCODE" 
         OnRowDeleted="grdDTCCRics_RowDeleted" 
        OnRowUpdated="grdDTCCRics_RowUpdated" 
        OnRowUpdating="grdDTCCRics_RowUpdating" 
        OnRowEditing="grdDTCCRics_RowEditing"
        OnPageIndexChanged="CmdCancel_Click" 
        DataSourceID="SqlDataSource1">
        <RowStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
        <EmptyDataRowStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle"  />
        <Columns>
            <asp:BoundField  DataField="REDCODE" HeaderText="REDCODE" ReadOnly="True" SortExpression="REDCODE" />
               <asp:TemplateField HeaderText="RIC" SortExpression="RIC">
                <EditItemTemplate>
                    <asp:TextBox ID="RICTextBox" runat="server" Text='<%# Eval("RIC") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="RICLabel" 
runat="Server" Text='<%# Eval("RIC") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="REGIONCODE" SortExpression="REGIONCODE">
                <EditItemTemplate>
                    <asp:DropDownList ID="RegionCodeList" runat="Server">
                     <asp:ListItem Text="AM" Value="1"></asp:ListItem>
                    <asp:ListItem Text="US" Value="2"></asp:ListItem>
                    <asp:ListItem Text="EU" Value="3"></asp:ListItem>
                    <asp:ListItem Text="JP" Value="4"></asp:ListItem>
                    <asp:ListItem Text="AS" Value="5"></asp:ListItem>
                    <asp:ListItem Text="OF" Value="6"></asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                    <ItemTemplate>            
                        <asp:Label ID="lblcountry" runat="server" Text = '<%# Eval("REGIONCODE") %>'></asp:Label>
                    </ItemTemplate>
            </asp:TemplateField>
          
            <asp:CommandField ShowEditButton="True" ValidationGroup="Upd"   ButtonType="Button" HeaderText="EDIT"  >
              <ControlStyle Height="22px" Width="50px" />
                   </Columns>
</GridView>


When I tried to get the editrowindex, the object lstRegion is coming as null in the rowEditing eventhandler. Any idea how to display it properly? Please help.

Thanks
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

AnswerRe: Dropdownlist not displaying selectedItem in GridView Pin
michaelschmitt6-Jun-10 23:19
michaelschmitt6-Jun-10 23:19 
GeneralRe: Dropdownlist not displaying selectedItem in GridView Pin
meeram3956-Jun-10 23:52
meeram3956-Jun-10 23:52 
GeneralRe: Dropdownlist not displaying selectedItem in GridView Pin
michaelschmitt7-Jun-10 0:06
michaelschmitt7-Jun-10 0:06 
GeneralRe: Dropdownlist not displaying selectedItem in GridView Pin
meeram3957-Jun-10 0:31
meeram3957-Jun-10 0:31 
GeneralRe: Dropdownlist not displaying selectedItem in GridView Pin
michaelschmitt7-Jun-10 1:43
michaelschmitt7-Jun-10 1:43 
AnswerRe: Dropdownlist not displaying selectedItem in GridView - Resolved Pin
meeram3957-Jun-10 1:41
meeram3957-Jun-10 1:41 
GeneralRe: Dropdownlist not displaying selectedItem in GridView - Resolved Pin
michaelschmitt7-Jun-10 1:45
michaelschmitt7-Jun-10 1:45 
QuestionDateFormat Problem in ASP.NET Pin
sharad Pyakurel6-Jun-10 21:57
sharad Pyakurel6-Jun-10 21:57 
AnswerRe: DateFormat Problem in ASP.NET Pin
saini arun6-Jun-10 22:06
saini arun6-Jun-10 22:06 
AnswerRe: DateFormat Problem in ASP.NET Pin
walterhevedeich6-Jun-10 22:47
professionalwalterhevedeich6-Jun-10 22:47 
GeneralRe: DateFormat Problem in ASP.NET Pin
sharad Pyakurel7-Jun-10 1:38
sharad Pyakurel7-Jun-10 1:38 
GeneralRe: DateFormat Problem in ASP.NET Pin
walterhevedeich7-Jun-10 2:28
professionalwalterhevedeich7-Jun-10 2:28 
AnswerRe: DateFormat Problem in ASP.NET [modified] Pin
kupps7-Jun-10 21:09
kupps7-Jun-10 21:09 
GeneralRe: DateFormat Problem in ASP.NET Pin
sharad Pyakurel8-Jun-10 18:08
sharad Pyakurel8-Jun-10 18:08 
AnswerRe: DateFormat Problem in ASP.NET Pin
Goutam Patra29-Jun-10 3:03
professionalGoutam Patra29-Jun-10 3:03 
QuestionTabContainer cannot have children of type 'System.Web.UI.UpdatePanel'. Pin
developerit6-Jun-10 21:05
developerit6-Jun-10 21:05 
AnswerRe: TabContainer cannot have children of type 'System.Web.UI.UpdatePanel'. Pin
Jamil Hallal6-Jun-10 21:55
professionalJamil Hallal6-Jun-10 21:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.