V
vinayak
Hi
I am displaying data in Datagrid in ASP.NET with
Edit/Update functionality for each row. On the same page I
have 2 Button controls which submits the request to
server. These button controls are Web Control & not HTML
control. One of these buttons whose title is Delete is
added on the aspx page in design view & also I double
clicked on this button in design view to get the onclick
code for this button in the code behind page. & for
creating the other button whose title is say SaveData I
copied the aspx syntax of the first button & also the
code behind code for Click event of this button. I have
taken care to give diferent id to both of these buttons.
Now there are 2 rows displayed in the datagrid &
both of these buttons are at the bottom. When I click on
Delete button (one which was added in design mode)
the request goes to the, server since there is no code
written in the onclick event of this button page gets
loaded with same data as it is. This is fine
But when I click on SaveData button (one which was
created by copying the aspx & aspx.cs code) request goes
to the server & even though the onclink event for
this button doesn't have any code to execute, the page
gets loaded with disturbed datagrid structure. In the page
the data is scattered because of uneven colspan for any
row gets added. I tried to debug the solution , then I
found even I am not binding any datasource in the Postback
on onclick of savedata button the ItemCreated event of the
datagrid gets fired which randomly sets any colspan to the
cells which are created, because of which I gets scattered
data when this data is rendered into the browser.
I didn't find any reason how this should happen in
Item created event.
I would be thankfull if anybody could suggest me
proper solution
Regards
Vinayak
I am displaying data in Datagrid in ASP.NET with
Edit/Update functionality for each row. On the same page I
have 2 Button controls which submits the request to
server. These button controls are Web Control & not HTML
control. One of these buttons whose title is Delete is
added on the aspx page in design view & also I double
clicked on this button in design view to get the onclick
code for this button in the code behind page. & for
creating the other button whose title is say SaveData I
copied the aspx syntax of the first button & also the
code behind code for Click event of this button. I have
taken care to give diferent id to both of these buttons.
Now there are 2 rows displayed in the datagrid &
both of these buttons are at the bottom. When I click on
Delete button (one which was added in design mode)
the request goes to the, server since there is no code
written in the onclick event of this button page gets
loaded with same data as it is. This is fine
But when I click on SaveData button (one which was
created by copying the aspx & aspx.cs code) request goes
to the server & even though the onclink event for
this button doesn't have any code to execute, the page
gets loaded with disturbed datagrid structure. In the page
the data is scattered because of uneven colspan for any
row gets added. I tried to debug the solution , then I
found even I am not binding any datasource in the Postback
on onclick of savedata button the ItemCreated event of the
datagrid gets fired which randomly sets any colspan to the
cells which are created, because of which I gets scattered
data when this data is rendered into the browser.
I didn't find any reason how this should happen in
Item created event.
I would be thankfull if anybody could suggest me
proper solution
Regards
Vinayak