You must Sign In to post a response.
  • Category: ASP.NET

    If i press enter it direclty goes to the view2

    my source
    <asp:MultiView ID="MultiView1" runat="server">
    <asp:View ID="View1" runat="server">
    <table class="style1" align="center" style="border: thin outset #1d599e; width: 100%; margin-left: 0px; background-color:White;">
    <tr><td style="margin-left: 80px; background:#1d599e;" colspan="2" align="center" >
    <asp:Label ID="Label17" runat="server" Text="Employee Details"
    Style="color: #FFFFFF; font-size: large; font-weight: 700; text-align: center;"
    class="style10"></asp:Label></td></tr>
    <tr><td>
    <asp:Label ID="Label25" runat="server" Text="ID"></asp:Label>
    </td><td>
    <asp:TextBox ID="vewid" runat="server" ontextchanged="vewid_TextChanged"></asp:TextBox>
    </td></tr>
    <tr><td>
    <asp:Label ID="ffdate" runat="server" Text="From Date"></asp:Label>
    </td><td>
    <asp:TextBox ID="txtff" runat="server" AutoPostBack="True"
    ontextchanged="txtff_TextChanged"></asp:TextBox>
    <asp:Calendar ID="ffdar" runat="server"
    onselectionchanged="ffdar_SelectionChanged"></asp:Calendar>
    <asp:TextBox ID="ffdatetxt" runat="server" Visible="False"></asp:TextBox>
    </td></tr>
    <tr><td>
    <asp:Label ID="Label26" runat="server" Text="To Date"></asp:Label>
    </td><td>
    <asp:TextBox ID="txttodate" runat="server" AutoPostBack="True"
    ontextchanged="txttodate_TextChanged"></asp:TextBox>
    <asp:Calendar ID="toddr" runat="server"
    onselectionchanged="toddr_SelectionChanged"></asp:Calendar>
    <asp:TextBox ID="todatetxt" runat="server" Visible="False"></asp:TextBox>
    <br />
    </td></tr>
    <tr><td colspan="2" align="center">
    <asp:Button ID="b11" runat="server" onclick="b11_Click" Text="Button"
    Width="302px" />
    </td></tr> </table>
    </asp:View>

    <asp:View ID="View2" runat="server">
    <asp:GridView ID="GridView1" runat="server" BackColor="#CCCCCC"
    BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
    CellSpacing="2" ForeColor="Black" AutoGenerateColumns="false" Width="500px"
    ShowFooter="True">
    <RowStyle BackColor="White" /> <FooterStyle BackColor="Black" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" /><PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
    <Columns>
    <asp:TemplateField HeaderText="Name" ControlStyle-Width="120px"><ItemTemplate>
    <asp:Label ID="lsect" runat="server" Text='<%#Eval("Name")%>'></asp:Label></ItemTemplate>
    <ControlStyle Width="120px" />
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Date" ControlStyle-Width="120px"><ItemTemplate> <asp:Label ID="lexpen" runat="server" Text='<%#Eval("Date")%>'></asp:Label></ItemTemplate>
    <ControlStyle Width="120px" />
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Status" ControlStyle-Width="120px"><ItemTemplate> <asp:Label ID="ldate" runat="server" Text='<%#Eval("Status") %>'></asp:Label></ItemTemplate>
    <ControlStyle Width="120px" />
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Intime" ControlStyle-Width="120px"><ItemTemplate> <asp:Label ID="lbno" runat="server" Text='<%#Eval("Intime") %>'></asp:Label></ItemTemplate>
    <ControlStyle Width="120px" />
    </asp:TemplateField>


    <asp:TemplateField HeaderText="Outtime">
    <ItemTemplate>
    <asp:Label ID="lblSalary" runat="server" Text='<%# Eval("Outtime")%>' />
    </ItemTemplate>

    </asp:TemplateField>
    </Columns>


    </asp:GridView>

    <asp:Button ID="Button1" runat="server" Text="Next" onclick="Button1_Click"
    Width="328px" />
    </asp:View>
    </asp:MultiView>

    my code


    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    MultiView1.SetActiveView(View1);
    vewid.Focus();
    }
    }
    protected void vewid_TextChanged(object sender, EventArgs e)
    {
    txtff.Focus();
    }
    protected void txtff_TextChanged(object sender, EventArgs e)
    {
    txttodate.Focus();
    }
    protected void txttodate_TextChanged(object sender, EventArgs e)
    {
    b11.Focus();
    }
    protected void ffdar_SelectionChanged(object sender, EventArgs e)
    {
    txtff.Text = ffdar.SelectedDate.ToString("dd/MM/yyyy");
    ffdatetxt.Text = ffdar.SelectedDate.ToString("yyyy/MM/dd");
    }
    protected void toddr_SelectionChanged(object sender, EventArgs e)
    {
    txttodate.Text = toddr.SelectedDate.ToString("dd/MM/yyyy");
    todatetxt.Text = toddr.SelectedDate.ToString("yyyy/MM/dd");

    }
    protected void b11_Click(object sender, EventArgs e)
    {
    Session["fromdate"] = ffdatetxt.Text;
    Session["todate"] = todatetxt.Text;
    supdet();
    MultiView1.SetActiveView(View2);
    }
    private void supdet()
    {
    try
    {
    string qe = "select name,status,date,intime,outtime from aten where id='" + vewid.Text + "' and currentdate between '" + Session["fromdate"].ToString() + "' and '" + Session["todate"].ToString() + "' order by date";
    DataSet dss = new DataSet();
    dss = mvl.GETDS(qe);
    if (dss.Tables[0].Rows.Count != 0)
    {
    GridView1.DataSource = dss;
    GridView1.DataBind();
    }
    else if (dss.Tables[0].Rows.Count == 0)
    {
    Response.Write("<script>alert('Please Enter Valid Id !')</script>");
    }
    else
    {
    Response.Write("<script>alert('Please Enter Valid date !')</script>");
    }
    }
    catch (Exception e)
    {
    throw e;
    }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
    vewid.Focus();
    vewid.Text = "";
    txtff.Text = "";
    txttodate.Text = "";
    ffdar.SelectedDates.Remove(ffdar.SelectedDates[0]);
    toddr.SelectedDates.Remove(toddr.SelectedDates[0]);
    }


    i put break point but same thing is going on
  • #762401
    Hi selvi,

    What you are expecting from our end..?
    This is not a well formed question, please elaborate your question first, so that people will guide you accordingly.

    Hope you understood...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #762403
    in view1 i have id and currentdate fields from date and to date if i give the id it goes to the view 2.. c my source as well as code ..

  • #762407
    Hi

    if you need navigate the one view to another view means try this code



    <asp:MultiView ID="MultiView1" runat="server">
    <asp:View ID="View1" runat="server">
    <table>
    <tr>
    <td>
    View1
    <asp:Button ID="bt11" runat="server" Text="Click" OnClick="bt11_Click" />
    </td>
    </tr>
    </table>
    </asp:View>
    <asp:View ID="View2" runat="server">
    <table>
    <tr>
    <td>
    View2
    </td>
    </tr>
    </table>
    </asp:View>

    <asp:View ID="View3" runat="server">
    <table>
    <tr>
    <td>
    View3
    </td>
    </tr>
    </table>
    </asp:View>

    </asp:MultiView>



    server Side c#


    if (!Page.IsPostBack)
    {
    MultiView1.ActiveViewIndex = 0;
    }

    protected void bt11_Click(object sender, EventArgs e)
    {
    MultiView1.ActiveViewIndex = 1;
    }


    Initial stage you need set Index in your Multiview after that you need set increment or decrements set in your multiview as per your requirement.

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762418
    Hi

    Check this line when you click button automatically navigate next view so if you need change this as per your requirement.


    protected void b11_Click(object sender, EventArgs e)
    {
    Session["fromdate"] = ffdatetxt.Text;
    Session["todate"] = todatetxt.Text;
    supdet();
    MultiView1.SetActiveView(View2);
    }

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


Sign In to post your comments