Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Dinesh Priyankara #1
Strange behavior in DataGrid
Hi all,
Hope you can give me a solution for this. I am having lot of problems with
datagrid but like to come out with one by one.
My main problem is, sometime datagrid disappear. Still I couldn't find a
solution. But if you can give an answer for below mentioned one, it will
greatly help on my work.
when the user submit the page after some modification in the grid, I usually
get count on grid and get the updated values like below.
for (int i=0l; i < myGrid.Items.Count; i++)
{
//update part.....
}
but sometimes, it won't go through the loop. In order to test I add
Response.Write(myGrid.Items.Count.ToString()) statement to the code.
Unbelievable! sometimes this gives 0 for count even though rows were there.
Can anyone help me on this strange behavior.
Highly appreciate all your reply.
Dinesh Priyankara
Dinesh Priyankara Guest
-
Strange behavior
The problem seems to be in c code calling ruby calling c code. ======== start test.rb puts "about to require curses" require "curses" puts... -
Strange behavior of $.
Apparently $. is not always set correct (see second ruby 1liner). Is this a bug? 12:12:42 : cat -n n 1 2 3 BAR="hello" 4 12:12:47 : ruby... -
Strange behavior with HttpCookieCollection
Hi, I created a simple webform, put a test button on it and implemented a click handler that looks like so: private void btnTest_Click(object... -
Strange behavior of DBI/DBD::Informix
I tried sending this problem to the address specified in DBD::Informix::TechSupport (perldoc) - dbd-informix@us.ibm.com but... -
Why strange IF...ELSE behavior
Hi all, I'm getting a strange result with the following IF statement: $bar = ($foo == 'last') ? true : false; In my script $foo normaly has... -
Alvin Bruney #2
Re: Strange behavior in DataGrid
like you said the data grid does not appear when there is no data to be
rendered. the bug must lay in the way you are filling the datagrid with data
from your datasource. basically it doesn't always have data and you need to
check that it always does.
"Dinesh Priyankara" <dinesh@dineshpriyankara.com> wrote in message
news:O2V5GbJYDHA.2548@TK2MSFTNGP09.phx.gbl...usually> Hi all,
>
> Hope you can give me a solution for this. I am having lot of problems with
> datagrid but like to come out with one by one.
>
> My main problem is, sometime datagrid disappear. Still I couldn't find a
> solution. But if you can give an answer for below mentioned one, it will
> greatly help on my work.
>
> when the user submit the page after some modification in the grid, Ithere.> get count on grid and get the updated values like below.
>
> for (int i=0l; i < myGrid.Items.Count; i++)
> {
> //update part.....
> }
>
> but sometimes, it won't go through the loop. In order to test I add
> Response.Write(myGrid.Items.Count.ToString()) statement to the code.
>
> Unbelievable! sometimes this gives 0 for count even though rows were> Can anyone help me on this strange behavior.
>
> Highly appreciate all your reply.
>
> Dinesh Priyankara
>
>
Alvin Bruney Guest
-
Peter Wu #3
Re: Strange behavior in DataGrid
"Dinesh Priyankara" <dinesh@dineshpriyankara.com> writes:
Where do you put the above logic?> My main problem is, sometime datagrid disappear. Still I couldn't find a
> solution. But if you can give an answer for below mentioned one, it will
> greatly help on my work.
>
> when the user submit the page after some modification in the grid, I usually
> get count on grid and get the updated values like below.
>
> for (int i=0l; i < myGrid.Items.Count; i++)
> {
> //update part.....
> }
>
> but sometimes, it won't go through the loop. In order to test I add
> Response.Write(myGrid.Items.Count.ToString()) statement to the code.
--
Peter Wu
Powered by Microsoft Windows XP [Version 5.1.2600]
Peter Wu Guest
-
Dinesh Priyankara #4
Re: Strange behavior in DataGrid
This is the part of code in one of my forms
html code for grid:
<asp:datagrid id="dgdHolidayDetails" runat="server" Width="526px"
CellPadding="3" DataKeyField="Id" AutoGenerateColumns="False">
<AlternatingItemStyle CssClass="TableBlueRowVer11"></AlternatingItemStyle>
<ItemStyle CssClass="TableWhiteRowVer11"></ItemStyle>
<HeaderStyle Height="25px" CssClass="TableHed"></HeaderStyle>
<Columns>
<asp:BoundColumn Visible="False" DataField="Id" HeaderText="Id">
<HeaderStyle Width="10px"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Day">
<HeaderStyle HorizontalAlign="Center" Width="60px"></HeaderStyle>
<ItemTemplate>
<asp:Label id=lblDate runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Date","{0:d}") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Type">
<HeaderStyle Wrap="False" HorizontalAlign="Center"
Width="120px"></HeaderStyle>
<ItemTemplate>
<asp:Label id=lblType runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.HolidayType") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Description">
<HeaderStyle HorizontalAlign="Center"
Width="200px"></HeaderStyle>
<ItemTemplate>
<asp:Label id=lblDesc runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Description") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle Width="45px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:LinkButton id="LinkButton2" runat="server"
Text="Edit" CausesValidation="false"
CommandName="Edit"></asp:LinkButton>
<asp:LinkButton id="lbnDel" runat="server"
CommandName="Delete">Delete</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton id="LinkButton4" runat="server"
Text="Update" CommandName="Update"></asp:LinkButton>
<asp:LinkButton id="LinkButton3" runat="server"
Text="Cancel" CausesValidation="false"
CommandName="Cancel"></asp:LinkButton>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
in code behind:
The FillHolidayDetailGird is the method which load data into grid
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
FillHolidayDetailGird();
}
}
private void FillHolidayDetailGird()
{
dgdHolidayDetails.DataSource=Com.Holiday.getHolida yDetail();
dgdHolidayDetails.DataBind();
}
This is the editcommand event for the grid.
When the edit link is clicked in the grid, it will load some related data
from the grid according to the key (keyvalue in grid) and place all on text
boxes that are seperated from the grid..
After that user can submit the changes. This will done through the another
method that is writtern for submit button. In that method viewstate value is
used.
private void dgdHolidayDetails_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ViewState["ModeEdit"]=true;
ViewState["HolidayKey"]=int.Parse(e.Item.Cells[0].Text);
ddlHolidayType.SelectedIndex =
getSelectedHolidayType(((Label)e.Item.FindControl( "lblType")).Text);
txbHolidayDesc.Text =
Convert.ToString(((Label)e.Item.FindControl("lblDe sc")).Text);
LinkButton linkbtn = new LinkButton();
linkbtn = ((LinkButton) e.Item.Cells[0].FindControl("lbnDel"));
linkbtn.Enabled = false;
}
SOMETIMES, if I click on edit link in the grid, it won't place values to
text boxes and grid also disappear. If I refreshed the page (F5), then the
correct data is loaded to the text boxes and grid is appeared.
Highly appreciate if you can help me on this as I am stuck with my project.
Almost all forms, I am having this problem.
Dinesh
"Peter Wu" <peterwu@hotmail.com> wrote in message
news:r83qhp1e.fsf@hotmail.com...usually> "Dinesh Priyankara" <dinesh@dineshpriyankara.com> writes:
>> > My main problem is, sometime datagrid disappear. Still I couldn't find a
> > solution. But if you can give an answer for below mentioned one, it will
> > greatly help on my work.
> >
> > when the user submit the page after some modification in the grid, I>> > get count on grid and get the updated values like below.
> >
> > for (int i=0l; i < myGrid.Items.Count; i++)
> > {
> > //update part.....
> > }
> >
> > but sometimes, it won't go through the loop. In order to test I add
> > Response.Write(myGrid.Items.Count.ToString()) statement to the code.
> Where do you put the above logic?
>
> --
> Peter Wu
> Powered by Microsoft Windows XP [Version 5.1.2600]
Dinesh Priyankara Guest



Reply With Quote

