Click here to Skip to main content
15,892,072 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow can i check textbox null inside masterpage Pin
deepthy.p.m3-Jul-08 18:22
deepthy.p.m3-Jul-08 18:22 
AnswerRe: How can i check textbox null inside masterpage Pin
Sherin Iranimose3-Jul-08 19:35
Sherin Iranimose3-Jul-08 19:35 
GeneralRe: How can i check textbox null inside masterpage Pin
deepthy.p.m3-Jul-08 19:47
deepthy.p.m3-Jul-08 19:47 
GeneralRe: How can i check textbox null inside masterpage Pin
Sherin Iranimose3-Jul-08 20:04
Sherin Iranimose3-Jul-08 20:04 
GeneralRe: How can i check textbox null inside masterpage Pin
deepthy.p.m3-Jul-08 22:04
deepthy.p.m3-Jul-08 22:04 
QuestionHow to use "User Controls" in Web Form? [modified] Pin
nguyenhh3-Jul-08 17:52
nguyenhh3-Jul-08 17:52 
AnswerRe: How to use "User Controls" in Web Form? Pin
Sherin Iranimose3-Jul-08 19:24
Sherin Iranimose3-Jul-08 19:24 
GeneralRe: How to use "User Controls" in Web Form? Pin
nguyenhh5-Jul-08 8:12
nguyenhh5-Jul-08 8:12 
Sherin Iranimose,
I am learning .net, could you give me some example code to do this the correct way.
my web form file:

<%@ Import NameSpace="com.nangmoi" %> 
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Page Language="C#" MasterPageFile="~/MasterPageHome.master" Title="www.nangmoi.com" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
 <%@ Register src="Control/ControlFormBookSearch.ascx" tagname="ControlFormBookSearch" tagprefix="uc6" %> 
 
<script runat="server">  
    private BookManager objManager = new BookManager();    
    protected void Page_Load(object sender, EventArgs e)
    { 
        if (!IsPostBack){
            
            GridView1.DataSource = objManager.getAuthorByAll();
            GridView1.DataBind();                         
        }
    }
 
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        //TextBox searchValue = (TextBox)Page.FindControl("searchValue");
        TextBox searchValue = (TextBox)ControlFormBookSearch1.FindControl("searchValue");
        
        if (searchValue != null)
            Response.Write(searchValue.Text);
        else Response.Write("Bad request");  
    }
</script>
<uc6:ControlFormBookSearch ID="ControlFormBookSearch1" runat="server" /> &nbsp;



user control page
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlFormBookSearch.ascx.cs" Inherits="Control_ControlFormBookSearch" %>
   
<table style="padding:0; border:solid 0px;">
<tr valign="middle"> 
<td style="vertical-align:top;border-bottom:solid 0px">
Keyword:&nbsp;<asp:TextBox ID="searchValue" runat="server" value="test" />&nbsp;
</td> 
</tr> 
</table> 



user control code behind:

using System;
using System.Collections;
using System.Configuration;
using System.Data; 
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts; 

public partial class Control_ControlFormBookSearch : System.Web.UI.UserControl
{ 
    protected void Page_Load(object sender, EventArgs e)
    {
         
    }
    //How do i do this the correct way?? do i create properties like this?
    //then how do i use it from webform?
    public SearchValue{
         get {return searchValue.Text;}
         set (searchValue.Text = value;}
    }
}


Thanks!

Hai

AnswerRe: How to use "User Controls" in Web Form? Pin
viivekk3-Jul-08 19:29
viivekk3-Jul-08 19:29 
GeneralRe: How to use "User Controls" in Web Form? Pin
nguyenhh5-Jul-08 8:02
nguyenhh5-Jul-08 8:02 
QuestionSql Injection Pin
ngrj3-Jul-08 16:24
ngrj3-Jul-08 16:24 
AnswerRe: Sql Injection Pin
Mark Churchill3-Jul-08 16:52
Mark Churchill3-Jul-08 16:52 
GeneralRe: Sql Injection Pin
ngrj3-Jul-08 17:06
ngrj3-Jul-08 17:06 
QuestionWizard sidebar Pin
kjosh3-Jul-08 13:52
kjosh3-Jul-08 13:52 
Questionhow to generate query at runtime ......... help plzz Pin
dream_liner_7e73-Jul-08 10:37
dream_liner_7e73-Jul-08 10:37 
AnswerRe: how to generate query at runtime ......... help plzz Pin
Christian Graus3-Jul-08 10:58
protectorChristian Graus3-Jul-08 10:58 
AnswerRe: how to generate query at runtime ......... help plzz Pin
dream_liner_7e73-Jul-08 11:18
dream_liner_7e73-Jul-08 11:18 
Questioncan't align the asp:listItems to left Pin
gottimukkala3-Jul-08 6:22
gottimukkala3-Jul-08 6:22 
AnswerRe: can't align the asp:listItems to left Pin
Sherin Iranimose3-Jul-08 6:58
Sherin Iranimose3-Jul-08 6:58 
QuestionHow do add controls from 'codebehind' ? Pin
tina->newcoder3-Jul-08 6:11
tina->newcoder3-Jul-08 6:11 
AnswerRe: How do add controls from 'codebehind' ? Pin
Sherin Iranimose3-Jul-08 6:18
Sherin Iranimose3-Jul-08 6:18 
GeneralRe: How do add controls from 'codebehind' ? Pin
tina->newcoder3-Jul-08 6:23
tina->newcoder3-Jul-08 6:23 
GeneralRe: How do add controls from 'codebehind' ? Pin
Sherin Iranimose3-Jul-08 6:33
Sherin Iranimose3-Jul-08 6:33 
GeneralRe: How do add controls from 'codebehind' ? Pin
tina->newcoder3-Jul-08 6:55
tina->newcoder3-Jul-08 6:55 
GeneralRe: How do add controls from 'codebehind' ? Pin
Christian Graus3-Jul-08 7:34
protectorChristian Graus3-Jul-08 7:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.