J
Jeff
hi
asp.net 2.0
I have agridview which I'm trying to implement feature for directly editing
the rows in the gridview.
Here is the markup of the columns, as you see I have a boundfield and a
templatefield and some buttons.
My trouble is that I don't know how to access the values when updating the
gridview, below is my RowUpdating handler, where I've put a foreach loop to
loop through the values, nothing is displayed... I also wonder how to access
the value I specified as DataKeyNames in the RowUpdating handler... Maybe I
instead of having a boundfield should have a templatefield, which has a
edititemtemplate, but the boundfield changes appearens when clicking on the
edit button, it changes to a field in which I can enter data.... so I hope
it's possible to acccess that value....
<Columns>
<asp:BoundField DataField="Test" HeaderText="Test"
HeaderStyle-CssClass="columnHeader" />
<asp:TemplateField>
<ItemTemplate>ss</ItemTemplate>
<EditItemTemplate>edit</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField
ShowEditButton="true"
HeaderStyle-CssClass="columnHeader"
ItemStyle-Width="20" EditText="Endre" UpdateText="Lagre"
CancelText="Avbryt" />
<asp:ButtonField CommandName="Delete" ButtonType="Image"
ImageUrl="~/Images/Delete.gif" ItemStyle-Width="20"
HeaderStyle-CssClass="columnHeader" />
</Columns>
protected void gvTest_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
foreach (DictionaryEntry entry in e.NewValues)
{
Debug.WriteLine(entry.Key.ToString() + " = " + entry.Value.ToString());
}
}
any suggestions?
asp.net 2.0
I have agridview which I'm trying to implement feature for directly editing
the rows in the gridview.
Here is the markup of the columns, as you see I have a boundfield and a
templatefield and some buttons.
My trouble is that I don't know how to access the values when updating the
gridview, below is my RowUpdating handler, where I've put a foreach loop to
loop through the values, nothing is displayed... I also wonder how to access
the value I specified as DataKeyNames in the RowUpdating handler... Maybe I
instead of having a boundfield should have a templatefield, which has a
edititemtemplate, but the boundfield changes appearens when clicking on the
edit button, it changes to a field in which I can enter data.... so I hope
it's possible to acccess that value....
<Columns>
<asp:BoundField DataField="Test" HeaderText="Test"
HeaderStyle-CssClass="columnHeader" />
<asp:TemplateField>
<ItemTemplate>ss</ItemTemplate>
<EditItemTemplate>edit</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField
ShowEditButton="true"
HeaderStyle-CssClass="columnHeader"
ItemStyle-Width="20" EditText="Endre" UpdateText="Lagre"
CancelText="Avbryt" />
<asp:ButtonField CommandName="Delete" ButtonType="Image"
ImageUrl="~/Images/Delete.gif" ItemStyle-Width="20"
HeaderStyle-CssClass="columnHeader" />
</Columns>
protected void gvTest_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
foreach (DictionaryEntry entry in e.NewValues)
{
Debug.WriteLine(entry.Key.ToString() + " = " + entry.Value.ToString());
}
}
any suggestions?