Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0QUestions about Module development: How to do....QUestions about Module development: How to do....
Previous
 
Next
New Post
2/26/2006 11:28 AM
 
Hello,

I have been working on my first module, and this is one in which will not be for resale, and will not leave my building, as they are tailored to interact with our phone system, to get a phone extension list, and with our payroll system to build a staff listing (i.e. address/phone/job title/department). They are very much tailored to our building.

I created a module template, and when in the View.ascx.vb I removed all the code from lstContent_ItemDataBound. This is where I was putting all my code.  This worked, as all I am doing is readnig from a database, and putting the data out, in a gridview or repeater. So this all works fine.

But in doing this, I have a few questions. I stored my MSSQL connection in the web.config, Is this the best place to put it? Next, is there a better place to put my code than lstContent_ItemDataBound ? I'm unsure even WHY this sub routine is being executed, as I dont see it being called, and I dont see anything in the ascx file named lstContent. And the last quesiton is this. I need a dropdown box, that when an item is selected, the page refreshes and the query's Where Lastname LIKE @Selection is updated, showing only those with i.e. last name of 'Doe'. Well, I modified my SQL query to accept this, and I setup some Command.Paramters.Add and similar things. THe problem that I get is that, for some reason, when I make a selection with my dropdown box, with autopostback=true, the value I select isnt 'sticking'. What i mean by that, is when the page refreshes, it goes back to the first item, as I dont have a default set. This to me, seems like no view state is 'alive'. How can I fix this?

Thanks!
 
New Post
2/26/2006 1:09 PM
 
1) I suppose it would be better to remove all the code from the View control except for the Page_Load and put your code right there in a try...catch block (that is created with the module template).
2) The lstContent_ItemBound is an event handler fired after adding one row while lstContent.DataBind() execution. You may use <%# %> blocks in the ascx file instead, but this is a taste question.
3) The lstContent is a asp:DataList. The first control in View.ascx
4) As for the filter list box. I suppose the viewstate is ok the problem is that you are refill it with data on each page reload. The actual thing you should do is to put a block like that in the Page_Load event handler:
if (!IsPostBack)
{
    listBox1.DataSource = <the list of items in the listbox>;
    listBox1.DataBind();
}

Best regards, Evgeny
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0QUestions about Module development: How to do....QUestions about Module development: How to do....


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out