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

ASP.NET

 
GeneralRe: how to manipulate with sqlserver database using javascript from aspx page Pin
bijeshputhalath30-Aug-07 21:49
bijeshputhalath30-Aug-07 21:49 
QuestionPaging in dataList Pin
bijeshputhalath30-Aug-07 20:38
bijeshputhalath30-Aug-07 20:38 
AnswerRe: Paging in dataList Pin
hallie30-Aug-07 21:09
hallie30-Aug-07 21:09 
GeneralRe: Paging in dataList Pin
vidyasankar30-Aug-07 22:43
vidyasankar30-Aug-07 22:43 
Questionplz help me Pin
kumareshbabutmc30-Aug-07 19:51
kumareshbabutmc30-Aug-07 19:51 
QuestionPrevious Page Pin
waheed awan30-Aug-07 19:47
waheed awan30-Aug-07 19:47 
AnswerRe: Previous Page Pin
VenkataRamana.Gali31-Aug-07 1:45
VenkataRamana.Gali31-Aug-07 1:45 
Questionplease help problem in creating template at run time. Pin
imranafsari30-Aug-07 19:32
imranafsari30-Aug-07 19:32 
Hi all,
I am using asp.net and C# Visual studio 2005.
Let me explain the scenario. I have stored procedure which return very no of column based on condition. Becoz I have to show columnwise record I used datalist.
And becoz of query return different no of column based on condtion I created template class for design and itembinding at run time .
I manage to create template column() but confuse over how to bind data. As no of column differ at runtime.
Code I used I am attaching it below . if you have better approach please tell me

Please guide me .


1 public class MyTemplate:ITemplate
2 {
3 ListItemType templateType;
4 String para1, para2, para3, para4, para5;
5
6
7 public MyTemplate(System.Web.UI.WebControls.ListItemType type,string parameter1)
8 {
9 templateType = type;
10 para1 = parameter1;
11 }
12
13 //
14 public void InstantiateIn(System.Web.UI.Control container )
15 {
16 PlaceHolder ph = new PlaceHolder();
17 ImageMap imp = new ImageMap();
18 //declaration
19 imp.ID = "img1";
20
21 switch (templateType)
22 {
23 case ListItemType.Header:
24 // ph.Controls.Add(new LiteralControl("<html> <body>"));
25 ph.Controls.Add(new LiteralControl("&lt;table border=\"1\"&gt;" ));
26 break;
27 case ListItemType.Item:
28
29 ph.Controls.Add(new LiteralControl("&lt;tr align = left><td align = left >"));
30 ph.Controls.Add(imp);
31 // some code
32 //optional parameter
33 if (!((para1 == "categoryid") || (para1 == "customerid") || (para1 == "retailprice") || (para1 == "subcategory")))
34 {
35 ph.Controls.Add(item5);
36 ph.Controls.Add(new LiteralControl("&lt;br />"));
37
38 }
39
40 ph.Controls.Add(new LiteralControl("&lt;/td></tr>"));
41 ph.DataBinding += new EventHandler(Item_DataBinding);
42 break;
43
44 case ListItemType.Footer:
45 ph.Controls.Add(new LiteralControl("&lt;/table>"));
46
47 break;
48 }
49 container.Controls.Add(ph);
50 }
51
52
53 // container code end
54
55 static void Item_DataBinding(object sender, System.EventArgs e )
56 {
57 PlaceHolder ph = (PlaceHolder)sender;
58 DataListItem ri = (DataListItem)ph.NamingContainer;
59 //RepeaterItem ri = (RepeaterItem)ph.NamingContainer;
60 string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1");
61 // item1Value = (Int32)DataBinder.Eval(ri.DataItem, "CategoryID");
62 String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1");
63 String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1");
64 String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1");
65 String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ;
66 ((ImageMap)ph.FindControl("img1")).ImageUrl = impValue;
67 ((Label)ph.FindControl("item1")).Text = item1Value.ToString();
68 ((Label)ph.FindControl("item2")).Text = item2Value.ToString();
69 ((Label)ph.FindControl("item3")).Text = item3Value.ToString();
70 ((Label)ph.FindControl("item4")).Text = item4Value;
71
72
73 }
74
75 }
76
77
}





thanks




imaran khan
QuestionHow to set values to a formview control programmaically Pin
chathu03j30-Aug-07 19:17
chathu03j30-Aug-07 19:17 
QuestionDisplay / visible method in Javascript Pin
sandeep kumar pundhir30-Aug-07 15:56
sandeep kumar pundhir30-Aug-07 15:56 
AnswerRe: Display / visible method in Javascript Pin
Michael Sync30-Aug-07 16:09
Michael Sync30-Aug-07 16:09 
GeneralRe: Display / visible method in Javascript Pin
sandeep kumar pundhir30-Aug-07 16:56
sandeep kumar pundhir30-Aug-07 16:56 
GeneralRe: Display / visible method in Javascript Pin
Michael Sync30-Aug-07 21:40
Michael Sync30-Aug-07 21:40 
AnswerRe: Display / visible method in Javascript [modified] Pin
Imran Khan Pathan30-Aug-07 18:55
Imran Khan Pathan30-Aug-07 18:55 
QuestionTotal sum at child gridview footer Pin
hallie30-Aug-07 15:07
hallie30-Aug-07 15:07 
Questionparallel programming in c#????????? Pin
mr.mohsen30-Aug-07 12:36
mr.mohsen30-Aug-07 12:36 
AnswerRe: parallel programming in c#????????? Pin
ChrisKo31-Aug-07 13:45
ChrisKo31-Aug-07 13:45 
Question&ltasp:Login&gt within &ltAnonymousTemplate&gt? Pin
dandy7230-Aug-07 9:32
dandy7230-Aug-07 9:32 
AnswerRe: &ltasp:Login&gt within &ltAnonymousTemplate&gt? - why, yes Pin
dandy7230-Aug-07 9:44
dandy7230-Aug-07 9:44 
GeneralRe: &ltasp:Login&gt within &ltAnonymousTemplate&gt? - why, yes Pin
dandy7230-Aug-07 10:05
dandy7230-Aug-07 10:05 
QuestionPlease help asp Linkbutton Pin
netJP12L30-Aug-07 8:22
netJP12L30-Aug-07 8:22 
AnswerRe: Please help asp Linkbutton Pin
netJP12L30-Aug-07 10:51
netJP12L30-Aug-07 10:51 
GeneralRe: Please help asp Linkbutton Pin
mihirhp30-Aug-07 19:38
mihirhp30-Aug-07 19:38 
AnswerRe: Please help asp Linkbutton Pin
Imran Khan Pathan30-Aug-07 19:13
Imran Khan Pathan30-Aug-07 19:13 
GeneralRe: Please help asp Linkbutton Pin
netJP12L30-Aug-07 19:40
netJP12L30-Aug-07 19:40 

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.