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

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedModule Development Module Development
Previous
 
Next
New Post
10/30/2012 4:05 AM
 
Hello all

I Am new to module development. I have gone through the videos of Stan Schultes and read the book - Professional DotNetNuke ModuleProgramming - this is my exposure to Module development in DNN.

I am creating a new module called PatientInfo consists of InsertPatient ((InsertPatient.ascx) and EditPatient (EditPatient.ascx).

EditPatient.ascx shows all the patients in gridview with edit button inside the grid on each row. InsertPatient.ascx consists of all the fields to nsert patient info to the patient master table.

The requirement is once user enters into the editPatient form he can edit the particular patient details by clicking edit_button on that row, then the user has to enter into the InsertPatient.ascx control with all the fields populated for that particular patient. Till this point it s working fine.

The Problem is:
1.Once user enters into InsertPatient.ascx (loading dynamically), The onclick Save button in the InsertPatient.ascx is not triggering.
2. After saving the ascx control should go to the EditPatient.ascx page, how do I redirect.


The code for the InsertPatient.ascx is below (I have included just the patient name and phone number here to simplify the posting here):

Ascx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InsertPatient.ascx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="1" cellpadding="0" cellspacing="0" style="width: 934px;">
            <tr>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 934px">
                        <tr class="darkfield">
                            <td class="columnpadding">
                                Patient Name<a class="note">*</a>
                            </td>
                            <td class="colon">
                                :
                            </td>
                            <td class="star">
                                <asp:TextBox ID="txtPatientName" runat="server" CssClass="normaltextbox" MaxLength="20"
                                    TabIndex="1"></asp:TextBox>
                            </td>
                        </tr>
                        <tr id="trcontactNO" runat="server" class="darkfield" valign="top">
                            <td class="columnpadding">
                                Contact Number
                            </td>
                            <td class="colon">
                                <span id="colon" runat="server">:</span>
                            </td>
                            <td>
                                <asp:TextBox ID="txtContactNo" CssClass="normaltextbox" runat="server" MaxLength="10"
                                    TabIndex="3"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <asp:Button ID="btnSave" runat="server" CssClass="banner_head" Text="Submit" OnClick="btnSave_Click"
            Width="60px" TabIndex="10" />
        <asp:Button ID="btnCancel" runat="server" CssClass="banner_head" Text="Cancel" TabIndex="11"
            OnClick="btnCancel_Click" />
        <asp:Button ID="btnList" runat="server" CssClass="banner_head" Text="List" Width="60px"
            TabIndex="12" OnClick="btnList_Click" />
    </div>
    </form>
</body>
</html>


C# Code behind code:
protected void btnSave_Click(object sender, EventArgs e)
    {
        string strMsg=string.Empty;
        try
        {
            con = Connection.Get_Connection();
            SqlTransaction  mysqlTrans = con.BeginTransaction();
            SqlCommand mysqlCmd = new SqlCommand();
            mysqlCmd.Connection = con;
            mysqlCmd.Transaction = mysqlTrans;

            string sqlqry = "SELECT MAX (MPatientTId)AS MPatientTId FROM tblPatientM";
            mysqlCmd.CommandText = sqlqry;
            uint PatientId;
            object objMPatientTId = mysqlCmd.ExecuteScalar();
            if (objMPatientTId != DBNull.Value && objMPatientTId != null)
            {
                PatientId = Convert.ToUInt32(objMPatientTId) + 1;
            }
            else
            {
                PatientId = 1;
            }

            sqlqry = " INSERT INTO tblPatientM (MPatientName,MPatientContactNo)" +
                     " VALUES ('" + txtPatientName.Text + "','" + txtContactNo.Text + "')";

            strMsg = "Inserted";
            mysqlCmd.CommandText = sqlqry;
            mysqlCmd.ExecuteNonQuery();
            mysqlTrans.Commit();
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
        finally
        {
            if (con != null && con.State == ConnectionState.Open)
            {
                con.Close();
                con = null;
            }
        }
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        txtPatientName.Text = string.Empty;
        txtContactNo.Text = string.Empty;
    }




I dont know where I am making the mistake, can somebody please point it out.


Thankyou in Advance

Sharath RR

 
New Post
10/30/2012 7:52 AM
 
Delete

http://www.w3.org/TR/xhtml1/DTD/xhtml...>
< html xmlns="http://www.w3.org/1999/xhtml">
< head runat="server">
< title>
< /head>

< Body> and < /Body>
< /html>

Don't use <% Page ! Check the source code e.g. html module or blog on Codeplex !

Missing Namespace and using DotNetNuke controls on code behind!
 
New Post
10/31/2012 5:21 AM
 
I would suggest that maybe you need to go back and have another read of the resources you mentioned. In none of the resources you talked about would they have suggested writing code in the way that you have created it.

DNN modules are designed to be loaded dynamically inside the context of the dnn default.aspx page.

As such the module itself is NOT a web page - but instead just a control. What you have defined in your code is a web page.

http://www.adefwebserver.com/dotnetnu... is also a good place to start

Westa
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedModule Development Module Development


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