Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How can i handle post back event of the control that is added on the OnPreRender () method

Reply
Thread Tools

How can i handle post back event of the control that is added on the OnPreRender () method

 
 
Umut Tezduyar
Guest
Posts: n/a
 
      10-06-2004
Because of the fact that, handling events method (
IPostBackEventHandler.RaisePorstBackEvent method) is prior to OnPreRender
method, i cannot handle the events of the controls that i am adding on the
OnPreRender method. Is there a way for that. Can i manually tell asp.net
page to check again if there is control that is post backing to the server.

ex:

Load
IPostBackEventHandler.RaisePostBackEvent ( in this phase parameter is
selected, par = par1 or par = par2)
PreRender (Button is added according to the parameter selected o
RaisePostBackEvent, either par1 or par2)

After this phase, i cannot handle the event of the button added on pre
render phase


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-06-2004
Hi Umut,

From your description, you 're developing a custom sever control which is
adding some sub controls in the PreRender event, but this cause those sub
control's postback event unable to be fired, yes?

As for this problem, i'm afraid it is a by design behavior since the
controls'(on the page) 's postback event processing occurs when the page's
postback event handling occurs during page's serverside execution cycle and
we can't manually change that sequence or manually recall the post back
processing.

BTW, would you please tell us the reason why you need to add the controls
in the PreRender event, is there any particular needs? If so, we may try
finding some other means to workaround it. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
 
Umut Tezduyar
Guest
Posts: n/a
 
      10-06-2004
You have understood my problem exactly right.
I will give you an example why i need to add control on the on prerender.

Ex: Assume that i have a control. This control has three functions
1) Displaying book categories
2) Displaying books under selected categories
3) Showing the book details for the selected book.

Here is the scenario:
User sees books categories and selects one of them.
User sees books under the selected categories.
User selects a book from the list and sees its details.

Here is the code part.

OnLoad
Load the category list buttons to the system.
RaisePostBackEvent
Here it is determined which category is selected by understanding
which category button is pressed
OnPreRender
Loads book list and a button foreach book, that when it is clicked
to it, it shows the book details.

I wish i am clear enough to explain my problem. I can explain it more
briefly if it is not clear for you. I am waiting answers from you. Thank
you.

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Umut,
>
> From your description, you 're developing a custom sever control which is
> adding some sub controls in the PreRender event, but this cause those sub
> control's postback event unable to be fired, yes?
>
> As for this problem, i'm afraid it is a by design behavior since the
> controls'(on the page) 's postback event processing occurs when the page's
> postback event handling occurs during page's serverside execution cycle
> and
> we can't manually change that sequence or manually recall the post back
> processing.
>
> BTW, would you please tell us the reason why you need to add the controls
> in the PreRender event, is there any particular needs? If so, we may try
> finding some other means to workaround it. Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>



 
Reply With Quote
 
Robert Koritnik
Guest
Posts: n/a
 
      10-07-2004
Look like your understanding of ASP.Net might not be the best... Well.

Ok. You're control has three "parts":
- categories
- books
- details about a book

Ok. Let's try to simulate the behavior.

On first page load, you display only categories. And if you have a default
category also books about it.
The user then either:
- clicks a book to see its details or
- select another category

Postback occures.

You just create your your control in the pageLoad (if it's not static on teh
ASPX - which would be just fine) and databind books. Category could be
stored in viewstate so you bind to correct books.

Ok. Then you have a handler for:
- CategoryChange event and
- Book click event

Ok.
The one that happens will fire. If the category change fires you get the new
category and load apropriate books
If the book click happens, you display it's details.

I don't see a reason for PreRender event. It's just Page.Load,
DropDownList.Change, book.Click...

Everything can be handled "normally".

Ok. About book details. If your book was clicked you also have to store book
ID or something of the last selected book to databind it's details in the
page load.

that's all to it.

the page gets returned to the client. and everything goes on from the
beginning.

Or maybe I'm the one that doesn't get the idea of this behavior which is
also run on amazon (in it's own version).

BTW. You could also create three controls:
- categories
- books
- details

which you could use on other pages separately. On the page that they all
exist, those controls could provide data for one another.

--
RobertK
{ Clever? No just smart. }


"Umut Tezduyar" <(E-Mail Removed)> wrote in message
news:OQ$(E-Mail Removed)...
> You have understood my problem exactly right.
> I will give you an example why i need to add control on the on prerender.
>
> Ex: Assume that i have a control. This control has three functions
> 1) Displaying book categories
> 2) Displaying books under selected categories
> 3) Showing the book details for the selected book.
>
> Here is the scenario:
> User sees books categories and selects one of them.
> User sees books under the selected categories.
> User selects a book from the list and sees its details.
>
> Here is the code part.
>
> OnLoad
> Load the category list buttons to the system.
> RaisePostBackEvent
> Here it is determined which category is selected by understanding
> which category button is pressed
> OnPreRender
> Loads book list and a button foreach book, that when it is clicked
> to it, it shows the book details.
>
> I wish i am clear enough to explain my problem. I can explain it more
> briefly if it is not clear for you. I am waiting answers from you. Thank
> you.
>
> "Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi Umut,
> >
> > From your description, you 're developing a custom sever control which

is
> > adding some sub controls in the PreRender event, but this cause those

sub
> > control's postback event unable to be fired, yes?
> >
> > As for this problem, i'm afraid it is a by design behavior since the
> > controls'(on the page) 's postback event processing occurs when the

page's
> > postback event handling occurs during page's serverside execution cycle
> > and
> > we can't manually change that sequence or manually recall the post back
> > processing.
> >
> > BTW, would you please tell us the reason why you need to add the

controls
> > in the PreRender event, is there any particular needs? If so, we may try
> > finding some other means to workaround it. Thanks.
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! www.microsoft.com/security
> > (This posting is provided "AS IS", with no warranties, and confers no
> > rights.)
> >

>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-07-2004
Hi Umut,

Thanks for your followup and the detailed description. I think we can do
those things via some other means rather than create control in PreRender.
The WebCustomControl's "CreateChildControls" method is a very important
method, and generally we should put all the sub control construction in
that method.
And I'll try making a generic sample control on using that method and will
update you soon. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


 
Reply With Quote
 
Umut Tezduyar
Guest
Posts: n/a
 
      10-07-2004
I have a refernce book, ASP.Net Server Controls and Components
(http://www.microsoft.com/MSPress/books/5728.asp). I have looked its chapter
12 - composite controls again, but i couldn't find any answer to my
question. I am expecting your sample. Thank you a lot.

I think the main problerm is "Which control will be loaded next is defined
after the postback phase"

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Umut,
>
> Thanks for your followup and the detailed description. I think we can do
> those things via some other means rather than create control in PreRender.
> The WebCustomControl's "CreateChildControls" method is a very important
> method, and generally we should put all the sub control construction in
> that method.
> And I'll try making a generic sample control on using that method and will
> update you soon. Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-07-2004
Hi Umut,

Thanks for your followup. The composite control is just making use of other
existing sub controls to build a large control and as for your condition,
we need to add some part of the control depending on some certain value
that is setting in the control's certain sub control's post back event.
Then, we need to use a Property to represent such value and store the
property into ViewState so as to persistent between postbacks. And the
control create logical will be something like belowall the controls are
created in the "CreateChildControl" method

public string currentcategory
{
get{...}
set{
if(change ..)
{
update the control hierarchy(call the createchildcontrol to recreate the
control hierarchy)
}
}
}

function createchildcontrols()
{
......
if(currentcategory != null)
{
selectbooksbycategory();
display books in the selected records.
}

.....
}


Also, you can also have a look at Robert's suggestions, I think they also
provide some good guidance.
In addition, here is the full source code of my demo control:

#NOTE: I create the whole control hierarchy each time the
"CurrentCategory" or "CurrentBook" property is change, you may define your
own rule(such as only recreate part of them ) so as to optimize the
performance.
==================================
[DefaultProperty("Text"),
ToolboxData("<{0}:BookGallery runat=server></{0}:BookGallery>")]
public class BookGallery :
System.Web.UI.WebControls.WebControl,System.Web.UI .INamingContainer
{


private string text;

[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return text;
}

set
{
text = value;
}
}


//the current selected category
public string CurrentCategory
{
get
{
string category = ViewState["CURRENT_CATEGORY"] as string;
return category;
}
set
{
string category = ViewState["CURRENT_CATEGORY"] as string;
if(category == null || category != value)
{
ViewState["CURRENT_CATEGORY"] = value;
//recreate the control hierarchy
if(this.ChildControlsCreated)
{
this.ChildControlsCreated = false;
this.CreateChildControls();
}
}
}
}


// Currently selected Book
public string CurrentBook
{
get
{
string book = ViewState["CURRENT_BOOK"] as string;
return book;
}
set
{
string book = ViewState["CURRENT_BOOK"] as string;

if(book == null || book != value)
{
ViewState["CURRENT_BOOK"] = value;
if(this.ChildControlsCreated)
{
this.ChildControlsCreated = false;
this.CreateChildControls();
}
}
}
}



#region ---Create the control's entire control hierarchy---
protected override void CreateChildControls()
{
this.Controls.Clear();

int i=0;
Table tbMain = new Table();
tbMain.Attributes["width"] = "100%";
tbMain.Attributes["height"] = "100%";
tbMain.Attributes["border"] = "1";
tbMain.Rows.Add(new TableRow());
tbMain.Rows.Add(new TableRow());
tbMain.Rows[0].Cells.Add(new TableCell());
tbMain.Rows[0].Cells.Add(new TableCell());
tbMain.Rows[0].Cells.Add(new TableCell());
Label lbl;

lbl = new Label();
lbl.Text = "Book Category";
tbMain.Rows[0].Cells[0].Controls.Add(lbl);
lbl = new Label();
lbl.Text = "Books from selected category";
tbMain.Rows[0].Cells[1].Controls.Add(lbl);
lbl = new Label();
lbl.Text = "Selected Book's Detail";
tbMain.Rows[0].Cells[2].Controls.Add(lbl);



tbMain.Rows[1].Cells.Add(new TableCell());
tbMain.Rows[1].Cells.Add(new TableCell());
tbMain.Rows[1].Cells.Add(new TableCell());

Table tbCategorys = new Table();
tbCategorys.Attributes["height"] = "100%";

string[] categorys = DataHelper.GetCategorys();
for(i=0;i<categorys.Length;i++)
{
TableRow row = new TableRow();
row.Cells.Add(new TableCell());

LinkButton lbtn = new LinkButton();
lbtn.ID = "btnCategory_" + categorys[i];
lbtn.Text = categorys[i];
lbtn.CommandArgument = categorys[i];
lbtn.Click += new EventHandler(btnCategory_Click);

if(lbtn.Text == this.CurrentCategory)
{
lbtn.BackColor = System.Drawing.Color.Yellow;
}

row.Cells[0].Controls.Add(lbtn);
tbCategorys.Rows.Add(row);
}

Table tbBooks = new Table();
tbBooks.Attributes["height"] = "100%";
tbBooks.Rows.Add(new TableRow());
tbBooks.Rows[0].Cells.Add(new TableCell());



if(this.CurrentCategory != null)
{
Table tbBookList = new Table();
DataRow[] books = DataHelper.GetBooksByCategory(this.CurrentCategory );


for(i= 0;i<books.Length;i++)
{
TableRow row = new TableRow();
row.Cells.Add(new TableCell());
row.Cells.Add(new TableCell());
row.Cells.Add(new TableCell());

Label lblId = new Label();
lblId.Text = ((int)books[i]["id"]).ToString();

Label lblName = new Label();
lblName.Text = (string)books[i]["name"];

LinkButton lbtn = new LinkButton();
lbtn.Text = "View Details";
lbtn.CommandArgument = lblName.Text;
lbtn.Click +=new EventHandler(btnBook_Click);

row.Cells[0].Controls.Add(lblId);
row.Cells[1].Controls.Add(lblName);
row.Cells[2].Controls.Add(lbtn);

if(this.CurrentBook == lblName.Text)
{
row.BackColor = System.Drawing.Color.Yellow;
}

tbBookList.Rows.Add(row);

}

tbBooks.Rows[0].Cells[0].Controls.Add(tbBookList);

Label lblBookDetail = new Label();

if(this.CurrentBook != null)
{
lblBookDetail.Text = "Here is the detail information about the
book:<br>"
+ "<font size='20'>" + this.CurrentBook + "</font>";
}
else
{
lblBookDetail.Text = "No book is selected!";
}

tbMain.Rows[1].Cells[2].Controls.Add(lblBookDetail);
}
else
{
Label lblCurrentCategory = new Label();
lblCurrentCategory.Font.Size = new FontUnit(20);
lblCurrentCategory.Text = "Please select a book category.";

tbBooks.Rows[0].Cells[0].Controls.Add(lblCurrentCategory);
}

tbMain.Rows[1].Cells[0].Controls.Add(tbCategorys);
tbMain.Rows[1].Cells[1].Controls.Add(tbBooks);
this.Controls.Add(tbMain);

}

#endregion




#region ---custom event handlers---
private void btnCategory_Click(object sender, System.EventArgs e)
{
LinkButton lbtn = sender as LinkButton;
this.CurrentCategory = lbtn.CommandArgument;
}

private void btnBook_Click(object sender, System.EventArgs e)
{
LinkButton lbtn = sender as LinkButton;
this.CurrentBook = lbtn.CommandArgument;
}

#endregion


#region ---test helper classes---

public class DataHelper
{
private static string[] _categorys = null; // new
string[]{"vc","vb",".net","java","asm"};
private static DataTable _books = null;

static DataHelper()
{
_categorys = new string[]{"vc","vb",".net","java","asm"};

DataTable books = new DataTable("books");
books.Columns.Add("id",typeof(int));
books.Columns.Add("name",typeof(string));
books.Columns.Add("category",typeof(string));

DataRow row = null;
int bid = 0;
for(int i = 0; i < _categorys.Length; i++)
{
for(int j= 0; j<10; j++)
{
row = books.NewRow();
row["id"] = bid;
row["name"] = "Book_" + _categorys[i] + "_" + j;
row["category"] = _categorys[i];

books.Rows.Add(row);
bid++;
}
}

_books = books;
}

public static string[] GetCategorys()
{
return _categorys;
}

public static DataRow[] GetBooksByCategory(string category)
{
string filter = "category='" + category + "'";
DataRow[] rows = _books.Select(filter);

return rows;
}

}

#endregion

}

==================================

If there is any problem or questions, please feel free to let me know.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


 
Reply With Quote
 
Umut Tezduyar
Guest
Posts: n/a
 
      10-08-2004
I completely understand your code sample.
Thank you a lot, this probably completely solves my problem.
What my mistake is, adding controls in OnPrerender instead of recreating
control three in the event phase.

Can i contact with you for further different questions, if any

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Umut,
>
> Thanks for your followup. The composite control is just making use of
> other
> existing sub controls to build a large control and as for your condition,
> we need to add some part of the control depending on some certain value
> that is setting in the control's certain sub control's post back event.
> Then, we need to use a Property to represent such value and store the
> property into ViewState so as to persistent between postbacks. And the
> control create logical will be something like belowall the controls are
> created in the "CreateChildControl" method
>
> public string currentcategory
> {
> get{...}
> set{
> if(change ..)
> {
> update the control hierarchy(call the createchildcontrol to recreate the
> control hierarchy)
> }
> }
> }
>
> function createchildcontrols()
> {
> .....
> if(currentcategory != null)
> {
> selectbooksbycategory();
> display books in the selected records.
> }
>
> ....
> }
>
>
> Also, you can also have a look at Robert's suggestions, I think they also
> provide some good guidance.
> In addition, here is the full source code of my demo control:
>
> #NOTE: I create the whole control hierarchy each time the
> "CurrentCategory" or "CurrentBook" property is change, you may define your
> own rule(such as only recreate part of them ) so as to optimize the
> performance.
> ==================================
> [DefaultProperty("Text"),
> ToolboxData("<{0}:BookGallery runat=server></{0}:BookGallery>")]
> public class BookGallery :
> System.Web.UI.WebControls.WebControl,System.Web.UI .INamingContainer
> {
>
>
> private string text;
>
> [Bindable(true),
> Category("Appearance"),
> DefaultValue("")]
> public string Text
> {
> get
> {
> return text;
> }
>
> set
> {
> text = value;
> }
> }
>
>
> //the current selected category
> public string CurrentCategory
> {
> get
> {
> string category = ViewState["CURRENT_CATEGORY"] as string;
> return category;
> }
> set
> {
> string category = ViewState["CURRENT_CATEGORY"] as string;
> if(category == null || category != value)
> {
> ViewState["CURRENT_CATEGORY"] = value;
> //recreate the control hierarchy
> if(this.ChildControlsCreated)
> {
> this.ChildControlsCreated = false;
> this.CreateChildControls();
> }
> }
> }
> }
>
>
> // Currently selected Book
> public string CurrentBook
> {
> get
> {
> string book = ViewState["CURRENT_BOOK"] as string;
> return book;
> }
> set
> {
> string book = ViewState["CURRENT_BOOK"] as string;
>
> if(book == null || book != value)
> {
> ViewState["CURRENT_BOOK"] = value;
> if(this.ChildControlsCreated)
> {
> this.ChildControlsCreated = false;
> this.CreateChildControls();
> }
> }
> }
> }
>
>
>
> #region ---Create the control's entire control hierarchy---
> protected override void CreateChildControls()
> {
> this.Controls.Clear();
>
> int i=0;
> Table tbMain = new Table();
> tbMain.Attributes["width"] = "100%";
> tbMain.Attributes["height"] = "100%";
> tbMain.Attributes["border"] = "1";
> tbMain.Rows.Add(new TableRow());
> tbMain.Rows.Add(new TableRow());
> tbMain.Rows[0].Cells.Add(new TableCell());
> tbMain.Rows[0].Cells.Add(new TableCell());
> tbMain.Rows[0].Cells.Add(new TableCell());
> Label lbl;
>
> lbl = new Label();
> lbl.Text = "Book Category";
> tbMain.Rows[0].Cells[0].Controls.Add(lbl);
> lbl = new Label();
> lbl.Text = "Books from selected category";
> tbMain.Rows[0].Cells[1].Controls.Add(lbl);
> lbl = new Label();
> lbl.Text = "Selected Book's Detail";
> tbMain.Rows[0].Cells[2].Controls.Add(lbl);
>
>
>
> tbMain.Rows[1].Cells.Add(new TableCell());
> tbMain.Rows[1].Cells.Add(new TableCell());
> tbMain.Rows[1].Cells.Add(new TableCell());
>
> Table tbCategorys = new Table();
> tbCategorys.Attributes["height"] = "100%";
>
> string[] categorys = DataHelper.GetCategorys();
> for(i=0;i<categorys.Length;i++)
> {
> TableRow row = new TableRow();
> row.Cells.Add(new TableCell());
>
> LinkButton lbtn = new LinkButton();
> lbtn.ID = "btnCategory_" + categorys[i];
> lbtn.Text = categorys[i];
> lbtn.CommandArgument = categorys[i];
> lbtn.Click += new EventHandler(btnCategory_Click);
>
> if(lbtn.Text == this.CurrentCategory)
> {
> lbtn.BackColor = System.Drawing.Color.Yellow;
> }
>
> row.Cells[0].Controls.Add(lbtn);
> tbCategorys.Rows.Add(row);
> }
>
> Table tbBooks = new Table();
> tbBooks.Attributes["height"] = "100%";
> tbBooks.Rows.Add(new TableRow());
> tbBooks.Rows[0].Cells.Add(new TableCell());
>
>
>
> if(this.CurrentCategory != null)
> {
> Table tbBookList = new Table();
> DataRow[] books = DataHelper.GetBooksByCategory(this.CurrentCategory );
>
>
> for(i= 0;i<books.Length;i++)
> {
> TableRow row = new TableRow();
> row.Cells.Add(new TableCell());
> row.Cells.Add(new TableCell());
> row.Cells.Add(new TableCell());
>
> Label lblId = new Label();
> lblId.Text = ((int)books[i]["id"]).ToString();
>
> Label lblName = new Label();
> lblName.Text = (string)books[i]["name"];
>
> LinkButton lbtn = new LinkButton();
> lbtn.Text = "View Details";
> lbtn.CommandArgument = lblName.Text;
> lbtn.Click +=new EventHandler(btnBook_Click);
>
> row.Cells[0].Controls.Add(lblId);
> row.Cells[1].Controls.Add(lblName);
> row.Cells[2].Controls.Add(lbtn);
>
> if(this.CurrentBook == lblName.Text)
> {
> row.BackColor = System.Drawing.Color.Yellow;
> }
>
> tbBookList.Rows.Add(row);
>
> }
>
> tbBooks.Rows[0].Cells[0].Controls.Add(tbBookList);
>
> Label lblBookDetail = new Label();
>
> if(this.CurrentBook != null)
> {
> lblBookDetail.Text = "Here is the detail information about the
> book:<br>"
> + "<font size='20'>" + this.CurrentBook + "</font>";
> }
> else
> {
> lblBookDetail.Text = "No book is selected!";
> }
>
> tbMain.Rows[1].Cells[2].Controls.Add(lblBookDetail);
> }
> else
> {
> Label lblCurrentCategory = new Label();
> lblCurrentCategory.Font.Size = new FontUnit(20);
> lblCurrentCategory.Text = "Please select a book category.";
>
> tbBooks.Rows[0].Cells[0].Controls.Add(lblCurrentCategory);
> }
>
> tbMain.Rows[1].Cells[0].Controls.Add(tbCategorys);
> tbMain.Rows[1].Cells[1].Controls.Add(tbBooks);
> this.Controls.Add(tbMain);
>
> }
>
> #endregion
>
>
>
>
> #region ---custom event handlers---
> private void btnCategory_Click(object sender, System.EventArgs e)
> {
> LinkButton lbtn = sender as LinkButton;
> this.CurrentCategory = lbtn.CommandArgument;
> }
>
> private void btnBook_Click(object sender, System.EventArgs e)
> {
> LinkButton lbtn = sender as LinkButton;
> this.CurrentBook = lbtn.CommandArgument;
> }
>
> #endregion
>
>
> #region ---test helper classes---
>
> public class DataHelper
> {
> private static string[] _categorys = null; // new
> string[]{"vc","vb",".net","java","asm"};
> private static DataTable _books = null;
>
> static DataHelper()
> {
> _categorys = new string[]{"vc","vb",".net","java","asm"};
>
> DataTable books = new DataTable("books");
> books.Columns.Add("id",typeof(int));
> books.Columns.Add("name",typeof(string));
> books.Columns.Add("category",typeof(string));
>
> DataRow row = null;
> int bid = 0;
> for(int i = 0; i < _categorys.Length; i++)
> {
> for(int j= 0; j<10; j++)
> {
> row = books.NewRow();
> row["id"] = bid;
> row["name"] = "Book_" + _categorys[i] + "_" + j;
> row["category"] = _categorys[i];
>
> books.Rows.Add(row);
> bid++;
> }
> }
>
> _books = books;
> }
>
> public static string[] GetCategorys()
> {
> return _categorys;
> }
>
> public static DataRow[] GetBooksByCategory(string category)
> {
> string filter = "category='" + category + "'";
> DataRow[] rows = _books.Select(filter);
>
> return rows;
> }
>
> }
>
> #endregion
>
> }
>
> ==================================
>
> If there is any problem or questions, please feel free to let me know.
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-08-2004
Hi Umut,

Thanks for your followup. I'm also very glad that my work has been of
assistance. And of course, please feel free to post here if you have any
other questions on aspnet in the furture. I'm willing to try my best to
assit you. thanks again for posting here.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
How does a dynamic control load post back data across post back?? =?Utf-8?B?Z29yaWxsYQ==?= ASP .Net 1 05-25-2007 05:02 AM
How can i handle post back event of the control that is added on the OnPreRender () method Umut Tezduyar ASP .Net 1 10-06-2004 09:10 AM
Problem with adding UserControls programtic in the OnPreRender event and still keep the UC viewState Flare ASP .Net 5 11-21-2003 06:56 PM



Advertisments