473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Edit event in datagrid does not render

2
Hi,

I am using a asp:datagrid which is editable. Though I have handlers wired to my edit, update & cancel events, some how when i click on the edit button nothing happens. The edit template items does not appear. I have to click on the edit once again for the items to change. Same thing happens when i click on the update & cancel buttons.

I found that though the event handler gets executed the first time (in all 3 cases) , it does not reflect in my page. :-(.
Here is my code:


<asp:DataGrid ShowFooter="true" OnItemCommand="grdSharedAssemblies_ItemCommand" CellPadding="0"
OnCancelCommand="grdSharedAssemblies_CancelCommand " CellSpacing="0" OnEditCommand="grdSharedAssemblies_EditCommand"
OnUpdateCommand="grdSharedAssemblies_UpdateCommand " ID="grdSharedAssemblies" AutoGenerateColumns="false" runat="server" >
<Columns>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update"></asp:EditCommandColumn>
<asp:BoundColumn Visible="false" DataField="SHARED_ASSEMBLY_ID"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Shared Assembly Name">
<ItemStyle Width="200px" />
<ItemTemplate>
<asp:Label ID="lblSharedAssemblyName" Width="200px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "SHARED_ASSEMBLY_NAME") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Enter Shared Assembly Path">
<ItemStyle Width="400px" />
<ItemTemplate>
<asp:Label ID="lblSharedAssemblyPath" Width="400px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "VSTS_PATH") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtSharedAssemblyPath" Width="400px" Text='<%# DataBinder.Eval(Container.DataItem, "VSTS_PATH") %>' runat="server"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>


</Columns>
</asp:DataGrid>

& here is a sample handler

protected void grdSharedAssemblies_EditCommand(object source, DataGridCommandEventArgs e)
{
grdSharedAssemblies.EditItemIndex = e.Item.ItemIndex;

grdSharedAssemblies.ShowFooter = false;
}

Please do help me.....

Much thanks in advance
~rp
Sep 19 '06 #1
1 1602
rp13
2
Hi,

I was able to fix the problem. I had to ressign the datasource & do a databind to the grid in the Edit event handler(to be done in the update & cancel also.)
This solved my issues.. though I am not very sure y.. as i thought that the datagrid values would be persisted in view state..


protected void grdSharedAssemblies_EditCommand(object source, DataGridCommandEventArgs e)
{
grdSharedAssemblies.EditItemIndex = e.Item.ItemIndex;
DataSet ds = GetData();
grdSharedAssemblies.DataSource = ds;
grdSharedAssemblies.DataBind();

}
Could soemone pls clarify??

Much thanks,
Ramya
Sep 19 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Tamir Khason | last post by:
How to prevent the selected cell from being editable (visual) at DataGrid? Once click on cell (even readonly) there are cursor inside it and select text appears. How to prevent it Thankx
2
by: Stan | last post by:
This is how I access Pieces field in my editable datargid during Update event: protected void grdMain_OnUpdate(Object sender, DataGridCommandEventArgs e) { string Pieces = ((TextBox)...
2
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last,...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
3
by: Leo | last post by:
I have a datagrid with the first column as a Edit,Update,Cancel button column. The other 5 columns are template columns. When I click the Edit button in IE6 the row correctly displays the...
13
by: John M | last post by:
Hello, In Visual studio .NET 2003, On datagrid object : How can I link the button element : edit, to do a some client events (such as message box, and do another event just after that to the...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
14
by: TS | last post by:
I have this custom data list control and i override the onItemDatabound event. After upgrading to vs 2005, this event is not always getting called, though it does at other times. No changes were...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.