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

ASP.NET

 
AnswerRe: hey..urgent help needed with makin a site like orkut ... Pin
codelinks29-Aug-07 1:38
codelinks29-Aug-07 1:38 
GeneralRe: hey..urgent help needed with makin a site like orkut ... Pin
Vasudevan Deepak Kumar29-Aug-07 1:49
Vasudevan Deepak Kumar29-Aug-07 1:49 
GeneralRe: hey..urgent help needed with makin a site like orkut ... Pin
codelinks29-Aug-07 1:52
codelinks29-Aug-07 1:52 
Questionhow to add data to an empty detailsview? Pin
Big Ralph29-Aug-07 0:47
Big Ralph29-Aug-07 0:47 
QuestionHow to add Google search? Pin
Paramhans Dubey29-Aug-07 0:42
professionalParamhans Dubey29-Aug-07 0:42 
AnswerRe: How to add Google search? Pin
Vasudevan Deepak Kumar29-Aug-07 1:34
Vasudevan Deepak Kumar29-Aug-07 1:34 
GeneralRe: How to add Google search? Pin
Paramhans Dubey29-Aug-07 20:48
professionalParamhans Dubey29-Aug-07 20:48 
Questionhow to change behaviour of item_databinding of itemplate interface Pin
imranafsari29-Aug-07 0:39
imranafsari29-Aug-07 0:39 
Hi all,

I am using asp.net2.0 and C# VS2005.
I am creating asp.net web server control templates Dynamically .
My requirement is such that sp return very no of field( 4 or 5 or 6 …).
Now I am assigning it to datalist by creating web server control template dynamilly.
My problem is as no of field return very .how can I change databinding(which is method of itemplate) method so that I can bind data as per field. That is how can I change the behavior of method Item_DataBinding(itemplate interface) so that it accept parameter



Please help.

Code i am using …….

public class MyTemplate:ITemplate
{
ListItemType templateType;
String para1, para2, para3, para4, para5;


public MyTemplate(System.Web.UI.WebControls.ListItemType type , string parameter1)
{
templateType = type;
para1 = parameter1;
}

//
public void InstantiateIn(System.Web.UI.Control container )
{
PlaceHolder ph = new PlaceHolder();
ImageMap imp = new ImageMap();
//declaration
imp.ID = "img1";

switch (templateType)
{
case ListItemType.Header:
// ph.Controls.Add(new LiteralControl("<html> <body>"));
ph.Controls.Add(new LiteralControl("<table border=\"1\">" ));
break;
case ListItemType.Item:

ph.Controls.Add(new LiteralControl("<tr align = left><td align = left >"));
ph.Controls.Add(imp);
// some code
//optional parameter
if (!((para1 == "categoryid") || (para1 == "customerid") || (para1 == "retailprice") || (para1 == "subcategory")))
{
ph.Controls.Add(item5);
ph.Controls.Add(new LiteralControl("<br />"));

}

ph.Controls.Add(new LiteralControl("</td></tr>"));
ph.DataBinding += new EventHandler(Item_DataBinding);
break;

case ListItemType.Footer:
ph.Controls.Add(new LiteralControl("</table>"));

break;
}
container.Controls.Add(ph);
}


// container code end

<b>static void Item_DataBinding(object sender, System.EventArgs e )
{
PlaceHolder ph = (PlaceHolder)sender;
DataListItem ri = (DataListItem)ph.NamingContainer;
//RepeaterItem ri = (RepeaterItem)ph.NamingContainer;
string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1");
// item1Value = (Int32)DataBinder.Eval(ri.DataItem, "CategoryID");
String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1");
String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1");
String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1");
String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ;
((ImageMap)ph.FindControl("img1")).ImageUrl = impValue;
((Label)ph.FindControl("item1")).Text = item1Value.ToString();
((Label)ph.FindControl("item2")).Text = item2Value.ToString();
((Label)ph.FindControl("item3")).Text = item3Value.ToString();
((Label)ph.FindControl("item4")).Text = item4Value;
</b> }

}



thank you.



imran khan
Questionhow implement barcode in asp.net Pin
puspendra napit29-Aug-07 0:35
puspendra napit29-Aug-07 0:35 
AnswerRe: how implement barcode in asp.net Pin
Sathesh Sakthivel29-Aug-07 1:13
Sathesh Sakthivel29-Aug-07 1:13 
AnswerRe: how implement barcode in asp.net Pin
Christian Graus29-Aug-07 2:02
protectorChristian Graus29-Aug-07 2:02 
Questionhow to find out user name and domain name of a client browing aserver using asp.net Pin
nicetohaveyou29-Aug-07 0:15
nicetohaveyou29-Aug-07 0:15 
AnswerRe: how to find out user name and domain name of a client browing aserver using asp.net Pin
Craster29-Aug-07 1:36
Craster29-Aug-07 1:36 
Questiondatatable doubt Pin
saravanan0528-Aug-07 23:31
saravanan0528-Aug-07 23:31 
AnswerRe: datatable doubt Pin
Michael Sync28-Aug-07 23:42
Michael Sync28-Aug-07 23:42 
QuestionCall a Webservice in Firefox Pin
Abubakarsb28-Aug-07 23:24
Abubakarsb28-Aug-07 23:24 
AnswerRe: Call a Webservice in Firefox [modified] Pin
Michael Sync28-Aug-07 23:39
Michael Sync28-Aug-07 23:39 
GeneralRe: Call a Webservice in Firefox Pin
Vasudevan Deepak Kumar29-Aug-07 1:31
Vasudevan Deepak Kumar29-Aug-07 1:31 
GeneralRe: Call a Webservice in Firefox Pin
Michael Sync29-Aug-07 16:58
Michael Sync29-Aug-07 16:58 
AnswerRe: Call a Webservice in Firefox Pin
Vasudevan Deepak Kumar29-Aug-07 1:33
Vasudevan Deepak Kumar29-Aug-07 1:33 
QuestionDisable browser password remembering Pin
AlterD28-Aug-07 23:11
AlterD28-Aug-07 23:11 
AnswerRe: Disable browser password remembering Pin
Michael Sync28-Aug-07 23:36
Michael Sync28-Aug-07 23:36 
AnswerRe: Disable browser password remembering Pin
Vasudevan Deepak Kumar29-Aug-07 1:35
Vasudevan Deepak Kumar29-Aug-07 1:35 
QuestionHelp with a Message box Pin
cometburn00728-Aug-07 22:56
cometburn00728-Aug-07 22:56 
AnswerRe: Help with a Message box Pin
Michael Sync28-Aug-07 23:32
Michael Sync28-Aug-07 23:32 

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.